diff --git a/proxywrap.js b/proxywrap.js index 6c2ee99..1002604 100644 --- a/proxywrap.js +++ b/proxywrap.js @@ -136,6 +136,8 @@ exports.proxy = function(iface, options) { header = header.split(' '); if (!protocolError) { + + // Source properties of TCP connection Object.defineProperty(socket, 'remoteAddress', { enumerable: false, configurable: true, @@ -150,6 +152,22 @@ exports.proxy = function(iface, options) { return parseInt(header[4], 10); } }); + + // Destination properties of TCP connection + Object.defineProperty(socket, 'proxyAddress', { + enumerable: false, + configurable: true, + get: function() { + return header[3]; + } + }); + Object.defineProperty(socket, 'proxyPort', { + enumerable: false, + configurable: true, + get: function() { + return parseInt(header[5], 10); + } + }); } // unshifting will fire the readable event