proxy-chain
Advanced tools
Comparing version 0.1.15 to 0.1.16
@@ -226,2 +226,12 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'getStats', | ||
value: function getStats() { | ||
return { | ||
srcTxBytes: this.srcSocket ? this.srcSocket.bytesWritten : null, | ||
srcRxBytes: this.srcSocket ? this.srcSocket.bytesRead : null, | ||
trgTxBytes: this.trgSocket ? this.trgSocket.bytesWritten : null, | ||
trgRxBytes: this.trgSocket ? this.trgSocket.bytesRead : null | ||
}; | ||
} | ||
@@ -228,0 +238,0 @@ /** |
@@ -146,2 +146,4 @@ 'use strict'; | ||
_this2.trgSocket = socket; | ||
socket.once('close', function () { | ||
@@ -148,0 +150,0 @@ _this2.log('Target socket closed'); |
@@ -113,3 +113,3 @@ 'use strict'; | ||
* and provide URL to chained upstream proxy. It accepts a single parameter which is an object: | ||
* `{ request: Object, username: String, password: String, hostname: String, port: Number, isHttp: Boolean }` | ||
* `{ connectionId: Number, request: Object, username: String, password: String, hostname: String, port: Number, isHttp: Boolean }` | ||
* and returns an object (or promise resolving to the object) with following form: | ||
@@ -198,3 +198,2 @@ * `{ requestAuthentication: Boolean, upstreamProxyUrl: String }` | ||
this.log(request.method + ' ' + request.url + ' HTTP/' + request.httpVersion); | ||
// console.dir(request.headers); | ||
@@ -276,2 +275,3 @@ this.prepareRequestHandling(request).then(function (handlerOpts) { | ||
var funcOpts = { | ||
connectionId: result.id, | ||
request: request, | ||
@@ -325,2 +325,3 @@ username: null, | ||
}); | ||
handler.run(); | ||
@@ -437,2 +438,18 @@ } | ||
/** | ||
* Gets data transfer statistics of a specific proxy connection. | ||
* @param {Number} connectionId ID of the connection handler. | ||
* It is passed to `prepareRequestFunction` function. | ||
* @return {Object} statistics { srcTxBytes, srcRxBytes, trgTxBytes, trgRxBytes } | ||
*/ | ||
}, { | ||
key: 'getConnectionStats', | ||
value: function getConnectionStats(connectionId) { | ||
var handler = this.handlers && this.handlers[connectionId]; | ||
if (!handler) return undefined; | ||
return handler.getStats(); | ||
} | ||
/** | ||
* Closes the proxy server. | ||
@@ -439,0 +456,0 @@ * @param [closeConnections] If true, then all the pending connections from clients |
@@ -0,1 +1,5 @@ | ||
0.1.16 / 2018-01-09 | ||
================== | ||
- added measuring of proxy stats - see `getConnectionStats()`` function | ||
0.1.14 / 2017-12-19 | ||
@@ -2,0 +6,0 @@ ================== |
{ | ||
"name": "proxy-chain", | ||
"version": "0.1.15", | ||
"version": "0.1.16", | ||
"description": "Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining.", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86617
1321