Comparing version 2.0.1 to 2.0.2
@@ -293,2 +293,3 @@ "use strict"; | ||
sendSocks4InitialHandshake() { | ||
const userId = this._options.proxy.userId || ''; | ||
const buff = new smart_buffer_1.SmartBuffer(); | ||
@@ -301,3 +302,3 @@ buff.writeUInt8(0x04); | ||
buff.writeBuffer(ip.toBuffer(this._options.destination.host)); | ||
buff.writeStringNT(this._options.proxy.userId || ''); | ||
buff.writeStringNT(userId); | ||
// Socks 4a (hostname) | ||
@@ -310,3 +311,3 @@ } | ||
buff.writeUInt8(0x01); | ||
buff.writeStringNT(this._options.proxy.userId || ''); | ||
buff.writeStringNT(userId); | ||
buff.writeStringNT(this._options.destination.host); | ||
@@ -407,3 +408,3 @@ } | ||
else if (data[1] === constants_1.Socks5Auth.UserPass) { | ||
this.sendSocks5Authentication(); | ||
this.sendSocks5UserPassAuthentication(); | ||
} | ||
@@ -416,13 +417,15 @@ else { | ||
/** | ||
* Sends Socks v5 auth handshake. | ||
* Sends Socks v5 user & password auth handshake. | ||
* | ||
* Note: No auth and user/pass are currently supported. | ||
*/ | ||
sendSocks5Authentication() { | ||
sendSocks5UserPassAuthentication() { | ||
const userId = this._options.proxy.userId || ''; | ||
const password = this._options.proxy.password || ''; | ||
const buff = new smart_buffer_1.SmartBuffer(); | ||
buff.writeUInt8(0x01); | ||
buff.writeUInt8(Buffer.byteLength(this._options.proxy.userId)); | ||
buff.writeString(this._options.proxy.userId); | ||
buff.writeUInt8(Buffer.byteLength(this._options.proxy.password)); | ||
buff.writeString(this._options.proxy.password); | ||
buff.writeUInt8(Buffer.byteLength(userId)); | ||
buff.writeString(userId); | ||
buff.writeUInt8(Buffer.byteLength(password)); | ||
buff.writeString(password); | ||
this._socket.write(buff.toBuffer()); | ||
@@ -429,0 +432,0 @@ this.state = constants_1.SocksClientState.SentAuthenication; |
@@ -6,2 +6,12 @@ "use strict"; | ||
const net = require("net"); | ||
function normalizeSocksClientOptions(options) { | ||
options.proxy.userId = options.proxy.userId || ''; | ||
options.proxy.password = options.proxy.password || ''; | ||
} | ||
function normalizeSocksClientChainOptions(options) { | ||
options.proxies.forEach(proxy => { | ||
proxy.userId = proxy.userId || ''; | ||
proxy.password = proxy.password || ''; | ||
}); | ||
} | ||
/** | ||
@@ -8,0 +18,0 @@ * Validates the provided SocksClientOptions |
{ | ||
"name": "socks", | ||
"version": "2.0.1", | ||
"private": false, | ||
"version": "2.0.2", | ||
"description": "Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.", | ||
@@ -5,0 +6,0 @@ "main": "build/index.js", |
@@ -119,7 +119,7 @@ /// <reference types="node" /> | ||
/** | ||
* Sends Socks v5 auth handshake. | ||
* Sends Socks v5 user & password auth handshake. | ||
* | ||
* Note: No auth and user/pass are currently supported. | ||
*/ | ||
private sendSocks5Authentication(); | ||
private sendSocks5UserPassAuthentication(); | ||
/** | ||
@@ -126,0 +126,0 @@ * Handles Socks v5 auth handshake response. |
Sorry, the diff of this file is not supported yet
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
174631
1744