Comparing version 2.4.4 to 2.5.0
@@ -40,5 +40,16 @@ "use strict"; | ||
static createConnection(options, callback) { | ||
// Validate SocksClientOptions | ||
helpers_1.validateSocksClientOptions(options, ['connect']); | ||
return new Promise((resolve, reject) => { | ||
// Validate SocksClientOptions | ||
try { | ||
helpers_1.validateSocksClientOptions(options, ['connect']); | ||
} | ||
catch (err) { | ||
if (typeof callback === 'function') { | ||
callback(err); | ||
return resolve(); // Resolves pending promise (prevents memory leaks). | ||
} | ||
else { | ||
return reject(err); | ||
} | ||
} | ||
const client = new SocksClient(options); | ||
@@ -79,10 +90,21 @@ client.connect(options.existing_socket); | ||
static createConnectionChain(options, callback) { | ||
// Validate SocksClientChainOptions | ||
helpers_1.validateSocksClientChainOptions(options); | ||
// Shuffle proxies | ||
if (options.randomizeChain) { | ||
util_1.shuffleArray(options.proxies); | ||
} | ||
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { | ||
// Validate SocksClientChainOptions | ||
try { | ||
helpers_1.validateSocksClientChainOptions(options); | ||
} | ||
catch (err) { | ||
if (typeof callback === 'function') { | ||
callback(err); | ||
return resolve(); // Resolves pending promise (prevents memory leaks). | ||
} | ||
else { | ||
return reject(err); | ||
} | ||
} | ||
let sock; | ||
// Shuffle proxies | ||
if (options.randomizeChain) { | ||
util_1.shuffleArray(options.proxies); | ||
} | ||
try { | ||
@@ -89,0 +111,0 @@ // tslint:disable-next-line:no-increment-decrement |
{ | ||
"name": "socks", | ||
"private": false, | ||
"version": "2.4.4", | ||
"version": "2.5.0", | ||
"description": "Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.", | ||
@@ -36,11 +36,9 @@ "main": "build/index.js", | ||
"devDependencies": { | ||
"@types/chai": "^4.2.12", | ||
"@types/ip": "1.1.0", | ||
"@types/mocha": "^8.0.3", | ||
"@types/node": "^14.6.2", | ||
"chai": "^4.1.2", | ||
"@types/node": "^14.14.3", | ||
"coveralls": "3.1.0", | ||
"mocha": "^8.1.3", | ||
"mocha": "^8.2.0", | ||
"nyc": "15.1.0", | ||
"prettier": "^2.1.1", | ||
"prettier": "^2.1.2", | ||
"socks5-server": "^0.1.1", | ||
@@ -50,3 +48,3 @@ "ts-node": "^9.0.0", | ||
"tslint-config-airbnb": "^5.11.2", | ||
"typescript": "^4.0.2" | ||
"typescript": "^4.0.3" | ||
}, | ||
@@ -64,3 +62,3 @@ "dependencies": { | ||
"lint": "tslint --project tsconfig.json 'src/**/*.ts'", | ||
"build": "tslint --project tsconfig.json && prettier --write ./src/**/*.ts --config .prettierrc.yaml && tsc -p ." | ||
"build": "rm -rf build typings && tslint --project tsconfig.json && prettier --write ./src/**/*.ts --config .prettierrc.yaml && tsc -p ." | ||
}, | ||
@@ -67,0 +65,0 @@ "nyc": { |
Sorry, the diff of this file is not supported yet
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
142288
12
1366