tls: add localAddress and localPort properties

Add localAddress and localPort properties to tls.CleartextStream.
Like remoteAddress and localPort, delegate to the backing net.Socket
object.

Refs #5502.
This commit is contained in:
Ben Noordhuis
2013-05-20 15:14:30 +02:00
parent 812356049d
commit d820b64412
3 changed files with 22 additions and 0 deletions

View File

@@ -557,6 +557,14 @@ The string representation of the remote IP address. For example,
The numeric representation of the remote port. For example, `443`.
### cleartextStream.localAddress
The string representation of the local IP address.
### cleartextStream.localPort
The numeric representation of the local port.
[OpenSSL cipher list format documentation]: http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT
[BEAST attacks]: http://blog.ivanristic.com/2011/10/mitigating-the-beast-attack-on-tls.html
[CleartextStream]: #tls_class_tls_cleartextstream

View File

@@ -695,6 +695,17 @@ CleartextStream.prototype.__defineGetter__('remotePort', function() {
return this.socket && this.socket.remotePort;
});
CleartextStream.prototype.__defineGetter__('localAddress', function() {
return this.socket && this.socket.localAddress;
});
CleartextStream.prototype.__defineGetter__('localPort', function() {
return this.socket && this.socket.localPort;
});
function EncryptedStream(pair, options) {
CryptoStream.call(this, pair, options);
}

View File

@@ -41,6 +41,9 @@ var server = tls.Server(options, function(s) {
assert.equal(s.remoteAddress, s.socket.remoteAddress);
assert.equal(s.remotePort, s.socket.remotePort);
assert.equal(s.localAddress, s.socket.localAddress);
assert.equal(s.localPort, s.socket.localPort);
s.end();
});