Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

proxy-chain

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proxy-chain - npm Package Compare versions

Comparing version 0.1.11 to 0.1.12

44

build/anonymize_proxy.js

@@ -26,4 +26,5 @@ 'use strict';

var ANONYMIZED_PROXY_PORTS = exports.ANONYMIZED_PROXY_PORTS = {
FROM: 55000,
TO: 65000
FROM: 20000,
TO: 60000,
RETRY_COUNT: 10
};

@@ -73,19 +74,30 @@

return _bluebird2.default.resolve().then(function () {
return _findFreePort();
}).then(function (result) {
port = result;
server = new _server.Server({
// verbose: true,
port: port,
prepareRequestFunction: function prepareRequestFunction() {
return {
requestAuthentication: false,
upstreamProxyUrl: proxyUrl
};
var startServer = function startServer(maxRecursion) {
return _bluebird2.default.resolve().then(function () {
return _findFreePort();
}).then(function (result) {
port = result;
server = new _server.Server({
// verbose: true,
port: port,
prepareRequestFunction: function prepareRequestFunction() {
return {
requestAuthentication: false,
upstreamProxyUrl: proxyUrl
};
}
});
return server.listen();
}).catch(function (err) {
// It might happen that the port was taken in the meantime,
// in which case retry the search
if (err.code === 'EADDRINUSE' && maxRecursion > 0) {
return startServer(maxRecursion - 1);
}
throw err;
});
};
return server.listen();
}).then(function () {
return startServer(ANONYMIZED_PROXY_PORTS.RETRY_COUNT).then(function () {
var url = 'http://127.0.0.1:' + port;

@@ -92,0 +104,0 @@ anonymizedProxyUrlToServer[url] = server;

@@ -408,7 +408,23 @@ 'use strict';

return _bluebird2.default.promisify(this.server.listen.bind(this.server))(this.port).then(function () {
_this7.log('Listening...');
}).catch(function (err) {
_this7.log('Listen failed: ' + err);
throw err;
return new _bluebird2.default(function (resolve, reject) {
// Unfortunately server.listen() is not a normal function that fails on error,
// so we need this trickery
var onError = function onError(err) {
_this7.log('Listen failed: ' + err);
removeListeners();
reject(err);
};
var onListening = function onListening() {
_this7.log('Listening...');
removeListeners();
resolve();
};
var removeListeners = function removeListeners() {
_this7.server.removeListener('error', onError);
_this7.server.removeListener('listening', onListening);
};
_this7.server.on('error', onError);
_this7.server.on('listening', onListening);
_this7.server.listen(_this7.port);
}).nodeify(callback);

@@ -415,0 +431,0 @@ }

{
"name": "proxy-chain",
"version": "0.1.11",
"version": "0.1.12",
"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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc