Comparing version 2.3.2 to 2.3.3
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -228,3 +229,3 @@ }); | ||
else { | ||
this._socket.connect(this._options.proxy.port, this._options.proxy.host || this._options.proxy.ipaddress); | ||
this._socket.connect(this.getSocketOptions()); | ||
if (this._options.set_tcp_nodelay !== undefined && | ||
@@ -246,2 +247,6 @@ this._options.set_tcp_nodelay !== null) { | ||
} | ||
// Socket options (defaults host/port to options.proxy.host/options.proxy.port) | ||
getSocketOptions() { | ||
return Object.assign(Object.assign({}, this._options.socket_options), { host: this._options.proxy.host || this._options.proxy.ipaddress, port: this._options.proxy.port }); | ||
} | ||
/** | ||
@@ -248,0 +253,0 @@ * Handles internal Socks timeout callback. |
{ | ||
"name": "socks", | ||
"private": false, | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.", | ||
@@ -36,23 +36,23 @@ "main": "build/index.js", | ||
"devDependencies": { | ||
"@types/chai": "4.1.2", | ||
"@types/ip": "^0.0.30", | ||
"@types/mocha": "5.0.0", | ||
"@types/node": "9.6.2", | ||
"@types/chai": "4.2.4", | ||
"@types/ip": "1.1.0", | ||
"@types/mocha": "5.2.7", | ||
"@types/node": "12.12.6", | ||
"chai": "^4.1.2", | ||
"coveralls": "^3.0.0", | ||
"mocha": "5.0.5", | ||
"nyc": "11.6.0", | ||
"mocha": "6.2.2", | ||
"nyc": "14.1.1", | ||
"prettier": "^1.9.2", | ||
"socks5-server": "^0.1.1", | ||
"ts-node": "5.0.1", | ||
"ts-node": "8.4.1", | ||
"tslint": "^5.8.0", | ||
"typescript": "2.8.1" | ||
"typescript": "3.7.2" | ||
}, | ||
"dependencies": { | ||
"ip": "^1.1.5", | ||
"smart-buffer": "4.0.2" | ||
"ip": "1.1.5", | ||
"smart-buffer": "^4.1.0" | ||
}, | ||
"scripts": { | ||
"prepublish": "npm install -g typescript && npm run build", | ||
"test": "NODE_ENV=test mocha --recursive --compilers ts:ts-node/register test/**/*.ts", | ||
"test": "NODE_ENV=test mocha --recursive --require ts-node/register test/**/*.ts", | ||
"coverage": "NODE_ENV=test nyc npm test", | ||
@@ -59,0 +59,0 @@ "coveralls": "NODE_ENV=test nyc npm test && nyc report --reporter=text-lcov | coveralls", |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
import { Duplex } from 'stream'; | ||
interface SocksClient { | ||
declare interface SocksClient { | ||
on(event: 'error', listener: (err: SocksClientError) => void): this; | ||
@@ -63,6 +63,7 @@ on(event: 'bound', listener: (info: SocksClientBoundEvent) => void): this; | ||
*/ | ||
private get state(); | ||
/** | ||
* Internal state setter. If the SocksClient is in an error state, it cannot be changed to a non error state. | ||
*/ | ||
private state; | ||
private set state(value); | ||
/** | ||
@@ -73,2 +74,3 @@ * Starts the connection establishment to the proxy and destination. | ||
connect(existing_socket?: Duplex): void; | ||
private getSocketOptions; | ||
/** | ||
@@ -78,7 +80,7 @@ * Handles internal Socks timeout callback. | ||
*/ | ||
private onEstablishedTimeout(); | ||
private onEstablishedTimeout; | ||
/** | ||
* Handles Socket connect event. | ||
*/ | ||
private onConnect(); | ||
private onConnect; | ||
/** | ||
@@ -88,7 +90,7 @@ * Handles Socket data event. | ||
*/ | ||
private onDataReceived(data); | ||
private onDataReceived; | ||
/** | ||
* Handles processing of the data we have received. | ||
*/ | ||
private processData(); | ||
private processData; | ||
/** | ||
@@ -98,3 +100,3 @@ * Handles Socket close event. | ||
*/ | ||
private onClose(); | ||
private onClose; | ||
/** | ||
@@ -104,7 +106,7 @@ * Handles Socket error event. | ||
*/ | ||
private onError(err); | ||
private onError; | ||
/** | ||
* Removes internal event listeners on the underlying Socket. | ||
*/ | ||
private removeInternalSocketHandlers(); | ||
private removeInternalSocketHandlers; | ||
/** | ||
@@ -114,7 +116,7 @@ * Closes and destroys the underlying Socket. Emits an error event. | ||
*/ | ||
private _closeSocket(err); | ||
private _closeSocket; | ||
/** | ||
* Sends initial Socks v4 handshake request. | ||
*/ | ||
private sendSocks4InitialHandshake(); | ||
private sendSocks4InitialHandshake; | ||
/** | ||
@@ -124,3 +126,3 @@ * Handles Socks v4 handshake response. | ||
*/ | ||
private handleSocks4FinalHandshakeResponse(); | ||
private handleSocks4FinalHandshakeResponse; | ||
/** | ||
@@ -130,7 +132,7 @@ * Handles Socks v4 incoming connection request (BIND) | ||
*/ | ||
private handleSocks4IncomingConnectionResponse(); | ||
private handleSocks4IncomingConnectionResponse; | ||
/** | ||
* Sends initial Socks v5 handshake request. | ||
*/ | ||
private sendSocks5InitialHandshake(); | ||
private sendSocks5InitialHandshake; | ||
/** | ||
@@ -140,3 +142,3 @@ * Handles initial Socks v5 handshake response. | ||
*/ | ||
private handleInitialSocks5HandshakeResponse(); | ||
private handleInitialSocks5HandshakeResponse; | ||
/** | ||
@@ -147,3 +149,3 @@ * Sends Socks v5 user & password auth handshake. | ||
*/ | ||
private sendSocks5UserPassAuthentication(); | ||
private sendSocks5UserPassAuthentication; | ||
/** | ||
@@ -153,7 +155,7 @@ * Handles Socks v5 auth handshake response. | ||
*/ | ||
private handleInitialSocks5AuthenticationHandshakeResponse(); | ||
private handleInitialSocks5AuthenticationHandshakeResponse; | ||
/** | ||
* Sends Socks v5 final handshake request. | ||
*/ | ||
private sendSocks5CommandRequest(); | ||
private sendSocks5CommandRequest; | ||
/** | ||
@@ -163,9 +165,9 @@ * Handles Socks v5 final handshake response. | ||
*/ | ||
private handleSocks5FinalHandshakeResponse(); | ||
private handleSocks5FinalHandshakeResponse; | ||
/** | ||
* Handles Socks v5 incoming connection request (BIND). | ||
*/ | ||
private handleSocks5IncomingConnectionResponse(); | ||
readonly socksClientOptions: SocksClientOptions; | ||
private handleSocks5IncomingConnectionResponse; | ||
get socksClientOptions(): SocksClientOptions; | ||
} | ||
export { SocksClient, SocksClientOptions, SocksClientChainOptions, SocksRemoteHost, SocksProxy, SocksUDPFrameDetails }; |
/// <reference types="node" /> | ||
import { Duplex } from 'stream'; | ||
import { Socket } from 'net'; | ||
import { Socket, SocketConnectOpts } from 'net'; | ||
import { RequireOnlyOne } from './util'; | ||
@@ -47,3 +47,3 @@ declare const DEFAULT_TIMEOUT = 30000; | ||
bind = 2, | ||
associate = 3, | ||
associate = 3 | ||
} | ||
@@ -54,3 +54,3 @@ declare enum Socks4Response { | ||
Rejected = 92, | ||
RejectedIdent = 93, | ||
RejectedIdent = 93 | ||
} | ||
@@ -60,3 +60,3 @@ declare enum Socks5Auth { | ||
GSSApi = 1, | ||
UserPass = 2, | ||
UserPass = 2 | ||
} | ||
@@ -72,3 +72,3 @@ declare enum Socks5Response { | ||
CommandNotSupported = 7, | ||
AddressNotSupported = 8, | ||
AddressNotSupported = 8 | ||
} | ||
@@ -78,3 +78,3 @@ declare enum Socks5HostType { | ||
Hostname = 3, | ||
IPv6 = 4, | ||
IPv6 = 4 | ||
} | ||
@@ -94,3 +94,3 @@ declare enum SocksClientState { | ||
Disconnected = 11, | ||
Error = 99, | ||
Error = 99 | ||
} | ||
@@ -125,2 +125,3 @@ /** | ||
set_tcp_nodelay?: boolean; | ||
socket_options?: SocketConnectOpts; | ||
} | ||
@@ -127,0 +128,0 @@ /** |
@@ -7,3 +7,3 @@ /// <reference types="node" /> | ||
constructor(size?: number); | ||
readonly length: number; | ||
get length(): number; | ||
append(data: Buffer): number; | ||
@@ -10,0 +10,0 @@ peek(length: number): Buffer; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1339
140234
32
+ Addedip@1.1.5(transitive)
+ Addedsmart-buffer@4.2.0(transitive)
- Removedip@1.1.9(transitive)
- Removedsmart-buffer@4.0.2(transitive)
Updatedip@1.1.5
Updatedsmart-buffer@^4.1.0