mirror of
https://github.com/nodejs/node-v0.x-archive.git
synced 2026-04-28 03:01:10 -04:00
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:
@@ -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
|
||||
|
||||
11
lib/tls.js
11
lib/tls.js
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user