summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/socks/build/client/socksclient.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/socks/build/client/socksclient.js')
-rw-r--r--deps/npm/node_modules/socks/build/client/socksclient.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/deps/npm/node_modules/socks/build/client/socksclient.js b/deps/npm/node_modules/socks/build/client/socksclient.js
index 10871ff625..5eb80ce911 100644
--- a/deps/npm/node_modules/socks/build/client/socksclient.js
+++ b/deps/npm/node_modules/socks/build/client/socksclient.js
@@ -1,9 +1,10 @@
"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());
});
};
@@ -225,7 +226,7 @@ class SocksClient extends events_1.EventEmitter {
this._socket.emit('connect');
}
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 &&
this._options.set_tcp_nodelay !== null) {
this._socket.setNoDelay(!!this._options.set_tcp_nodelay);
@@ -242,6 +243,10 @@ class SocksClient extends events_1.EventEmitter {
});
});
}
+ // 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 });
+ }
/**
* Handles internal Socks timeout callback.
* Note: If the Socks client is not BoundWaitingForConnection or Established, the connection will be closed.