Replaced socksv5 with a version that supports user context. Locks down the versions of some packages

This commit is contained in:
Zachary Boyd 2018-09-09 22:26:55 -04:00
parent c379350de7
commit 4553bcc82b
3 changed files with 21 additions and 10 deletions

10
package-lock.json generated
View file

@ -240,7 +240,7 @@
},
"winston": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/winston/-/winston-0.8.3.tgz",
"resolved": "http://registry.npmjs.org/winston/-/winston-0.8.3.tgz",
"integrity": "sha1-ZLar9M0Brcrv1QCTk7HY6L7BnbA=",
"requires": {
"async": "0.2.x",
@ -1085,7 +1085,7 @@
},
"jrpc2": {
"version": "git+https://github.com/znetstar/jrpc2.git#f1521bd3f2fa73d716e74bf8f746d08d5e03e7d7",
"from": "git+https://github.com/znetstar/jrpc2.git",
"from": "git+https://github.com/znetstar/jrpc2.git#f1521bd3f2fa73d716e74bf8f746d08d5e03e7d7",
"requires": {
"async": "^1.2",
"ws": "^6.0.0",
@ -1317,7 +1317,7 @@
},
"native-dns": {
"version": "git+https://github.com/znetstar/node-dns.git#336f1d3027b2a3da719b5cd65380219267901aeb",
"from": "git+https://github.com/znetstar/node-dns.git",
"from": "git+https://github.com/znetstar/node-dns.git#336f1d3027b2a3da719b5cd65380219267901aeb",
"requires": {
"ipaddr.js": "~0.1.3",
"native-dns-cache": "git+https://github.com/znetstar/native-dns-cache.git#7743c19bd1b70d0ec32a364aadc77fbcfd5a67ad",
@ -1925,8 +1925,8 @@
}
},
"socksv5": {
"version": "git+https://github.com/lee-elenbaas/socksv5.git#7039cb6aeb39fa3187b327bb2de5d1aedaae6a56",
"from": "git+https://github.com/lee-elenbaas/socksv5.git",
"version": "git+https://github.com/znetstar/socksv5.git#431e541390314adbbe765650d8d810ec1df38d8a",
"from": "git+https://github.com/znetstar/socksv5.git#431e541390314adbbe765650d8d810ec1df38d8a",
"requires": {
"ipv6": "*"
},

View file

@ -27,14 +27,14 @@
"eventemitter3": "^3.1.0",
"get-port": "^2.1.0",
"granax": "^3.1.3",
"jrpc2": "git+https://github.com/znetstar/jrpc2.git",
"jrpc2": "git+https://github.com/znetstar/jrpc2.git#f1521bd3f2fa73d716e74bf8f746d08d5e03e7d7",
"js-weighted-list": "^0.1.1",
"lodash": "^4.17.4",
"nanoid": "^1.0.2",
"native-dns": "git+https://github.com/znetstar/node-dns.git",
"native-dns": "git+https://github.com/znetstar/node-dns.git#336f1d3027b2a3da719b5cd65380219267901aeb",
"nconf": "^0.10.0",
"shelljs": "^0.8.2",
"socksv5": "git+https://github.com/lee-elenbaas/socksv5.git",
"socksv5": "git+https://github.com/znetstar/socksv5.git#431e541390314adbbe765650d8d810ec1df38d8a",
"temp": "^0.8.3",
"winston": "^3.0.0-rc5",
"yargs": "^11.0.0"

View file

@ -15,7 +15,7 @@ class SOCKSServer extends Server{
});
}
constructor(tor_pool, logger) {
constructor(tor_pool, logger, proxy_by_name) {
let handleConnection = (info, accept, deny) => {
let inbound_socket = accept(true);
var outbound_socket;
@ -81,8 +81,19 @@ class SOCKSServer extends Server{
super(handleConnection);
this.logger = logger || require('./winston-silent-logger');;
if (!proxy_by_name) {
this.logger.debug(`[socks]: connecting to a specific instance by name has ben turned off`);
let auth = socks.auth.None();
} else {
this.logger.debug(`[socks]: connecting to a specific instance by name has ben turned on`);
let auth = socks.auth.UserPassword(
(username, password, cb) => {
}
);
}
this.useAuth(socks.auth.None());
this.useAuth(auth);
}
};