From 6f62fc5889cad7dfba40a9db76d5a7cdfbce43b3 Mon Sep 17 00:00:00 2001 From: "lance.zhou" Date: Thu, 6 Aug 2015 11:22:55 +0800 Subject: [PATCH 1/4] data lost for accept(true) --- lib/server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/server.js b/lib/server.js index bcac647..277786f 100644 --- a/lib/server.js +++ b/lib/server.js @@ -110,9 +110,9 @@ Server.prototype._onConnection = function(socket) { if (intercept) { socket.write(BUF_REP_INTR_SUCCESS); socket.removeListener('error', onErrorNoop); - process.nextTick(function() { - socket.resume(); - }); + //process.nextTick(function() { + //socket.resume(); + //}); return socket; } else proxySocket(socket, reqInfo); From 0c6987bf4172926e7d008b61cb39efc7aad4b22d Mon Sep 17 00:00:00 2001 From: Carck Date: Tue, 27 Aug 2019 10:47:05 +0800 Subject: [PATCH 2/4] Remove ipv6 dependency --- lib/utils.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index b5c2457..3684d1c 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -15,15 +15,21 @@ exports.ipbytes = function(str) { throw new Error('Error parsing IP: ' + str); } } else if (type === 6) { - var addr = new ipv6.Address(str), - b = 0, - group; - if (!addr.valid) - throw new Error('Error parsing IP: ' + str); - nums = addr.parsedAddress; + var addr = str.split(':'), + b = 0, + group; + if(addr.length != 8){ + var index = addr.findIndex(function (value) { + return value == ''; + }); + var expand = new Array(8-addr.length+1); + expand.fill('0'); + addr[index]=expand; + addr.flat(); + } bytes = new Array(16); for (i = 0; i < 8; ++i, b += 2) { - group = parseInt(nums[i], 16); + group = parseInt(addr[i], 16); bytes[b] = group >>> 8; bytes[b + 1] = group & 0xFF; } From 6be9ae35e85aec1ef9219a8b9cc83233405c7b90 Mon Sep 17 00:00:00 2001 From: Carck Date: Tue, 27 Aug 2019 10:47:36 +0800 Subject: [PATCH 3/4] Remove ipv6 dependency --- lib/utils.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 3684d1c..4ba09b2 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,5 +1,4 @@ -var net = require('net'), - ipv6 = require('ipv6').v6; +var net = require('net'); exports.ipbytes = function(str) { var type = net.isIP(str), From 31de9d2a8e23eba1555caecf4b1018a9a5c889fd Mon Sep 17 00:00:00 2001 From: Carck Date: Tue, 27 Aug 2019 10:48:27 +0800 Subject: [PATCH 4/4] Remove ipv6 dependency --- package.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/package.json b/package.json index a007dc1..e9f58a5 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,6 @@ "scripts": { "test": "node test/test.js" }, - "dependencies": { - "ipv6": "*" - }, - "bundledDependencies": [ - "ipv6" - ], "engines": { "node": ">=0.10.0" }, "keywords": [ "socks", "socks5", "socksv5", "proxy" ], "licenses": [ { "type": "MIT", "url": "http://github.com/mscdex/socksv5/raw/master/LICENSE" } ],