socks 1.1.6 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -3
- package/lib/socks-agent.js +5 -3
- package/lib/socks-client.js +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
@@ -205,14 +205,14 @@ var socksAgent = new Socks.Agent({
|
|
205
205
|
ipaddress: "202.101.228.108",
|
206
206
|
port: 1080,
|
207
207
|
type: 5,
|
208
|
-
},
|
208
|
+
}},
|
209
209
|
true, // we are connecting to a HTTPS server, false for HTTP server
|
210
210
|
false // rejectUnauthorized option passed to tls.connect(). Only when secure is set to true
|
211
|
-
|
211
|
+
);
|
212
212
|
|
213
213
|
http.get({ hostname: 'google.com', port: '443', agent: socksAgent}, function (res) {
|
214
214
|
// Connection header by default is keep-alive, we have to manually end the socket
|
215
|
-
socksAgent.
|
215
|
+
socksAgent.encryptedSocket.end();
|
216
216
|
});
|
217
217
|
```
|
218
218
|
|
package/lib/socks-agent.js
CHANGED
@@ -48,7 +48,7 @@ SocksAgent.prototype.createConnection = function(req, opts, fn) {
|
|
48
48
|
};
|
49
49
|
|
50
50
|
cleartext = tls.connect(options, function (err) {
|
51
|
-
return fn(err, this)
|
51
|
+
return fn(err, this);
|
52
52
|
});
|
53
53
|
cleartext.on('error', fn);
|
54
54
|
|
@@ -64,7 +64,7 @@ SocksAgent.prototype.createConnection = function(req, opts, fn) {
|
|
64
64
|
*/
|
65
65
|
SocksAgent.prototype.addRequest = function(req, host, port, localAddress) {
|
66
66
|
var opts;
|
67
|
-
if ('object'
|
67
|
+
if ('object' === typeof host) {
|
68
68
|
// >= v0.11.x API
|
69
69
|
opts = host;
|
70
70
|
if (opts.host && opts.path) {
|
@@ -76,7 +76,7 @@ SocksAgent.prototype.addRequest = function(req, host, port, localAddress) {
|
|
76
76
|
} else {
|
77
77
|
// <= v0.10.x API
|
78
78
|
opts = { host: host, port: port };
|
79
|
-
if (null
|
79
|
+
if (null !== localAddress) {
|
80
80
|
opts.localAddress = localAddress;
|
81
81
|
}
|
82
82
|
}
|
@@ -97,6 +97,8 @@ SocksAgent.prototype.addRequest = function(req, host, port, localAddress) {
|
|
97
97
|
}
|
98
98
|
} else {
|
99
99
|
req.onSocket(socket);
|
100
|
+
//have to resume this socket when node 12
|
101
|
+
socket.resume();
|
100
102
|
}
|
101
103
|
});
|
102
104
|
|
package/lib/socks-client.js
CHANGED
@@ -4,26 +4,26 @@ var SmartBuffer = require('smart-buffer');
|
|
4
4
|
|
5
5
|
(function () {
|
6
6
|
|
7
|
-
|
7
|
+
var COMMAND = {
|
8
8
|
Connect: 0x01,
|
9
9
|
Bind: 0x02,
|
10
10
|
Associate: 0x03
|
11
11
|
};
|
12
12
|
|
13
|
-
|
13
|
+
var SOCKS4_RESPONSE = {
|
14
14
|
Granted: 0x5A,
|
15
15
|
Failed: 0x5B,
|
16
16
|
Rejected: 0x5C,
|
17
17
|
RejectedIdent: 0x5D
|
18
18
|
};
|
19
19
|
|
20
|
-
|
20
|
+
var SOCKS5_AUTH = {
|
21
21
|
NoAuth: 0x00,
|
22
22
|
GSSApi: 0x01,
|
23
23
|
UserPass: 0x02
|
24
24
|
};
|
25
25
|
|
26
|
-
|
26
|
+
var SOCKS5_RESPONSE = {
|
27
27
|
Granted: 0x00,
|
28
28
|
Failure: 0x01,
|
29
29
|
NotAllowed: 0x02,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "socks",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.10",
|
4
4
|
"description": "A SOCKS proxy client supporting SOCKS 4, 4a, and 5. (also supports BIND/Associate)",
|
5
5
|
"main": "index.js",
|
6
6
|
"homepage": "https://github.com/JoshGlazebrook/socks",
|
@@ -33,7 +33,7 @@
|
|
33
33
|
],
|
34
34
|
"license": "MIT",
|
35
35
|
"dependencies": {
|
36
|
-
"ip": "^
|
37
|
-
"smart-buffer": "^1.0.
|
36
|
+
"ip": "^1.1.4",
|
37
|
+
"smart-buffer": "^1.0.13"
|
38
38
|
}
|
39
39
|
}
|