socks 1.1.5 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- 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
|
|
@@ -220,7 +220,7 @@ http.get({ hostname: 'google.com', port: '443', agent: socksAgent}, function (re
|
|
220
220
|
|
221
221
|
There are only three exported functions that you will ever need to use.
|
222
222
|
|
223
|
-
###Socks.createConnection( options, callback(err, socket, info) )
|
223
|
+
### Socks.createConnection( options, callback(err, socket, info) )
|
224
224
|
> `Object` **Object containing options to use when creating this connection**
|
225
225
|
|
226
226
|
> `function` **Callback that is called when connection completes or errors**
|
@@ -299,7 +299,7 @@ function(err, socket, info) {
|
|
299
299
|
}
|
300
300
|
```
|
301
301
|
|
302
|
-
###Socks.createUDPFrame( target, data, [frame] )
|
302
|
+
### Socks.createUDPFrame( target, data, [frame] )
|
303
303
|
> `Object` **Target host object containing destination for UDP packet**
|
304
304
|
|
305
305
|
> `Buffer` **Data Buffer to send in the UDP packet**
|
@@ -325,7 +325,7 @@ var target =
|
|
325
325
|
|
326
326
|
```
|
327
327
|
|
328
|
-
###Socks.Agent( options, tls) )
|
328
|
+
### Socks.Agent( options, tls) )
|
329
329
|
> `Object` **Object containing options to use when creating this connection (see above in createConnection)**
|
330
330
|
|
331
331
|
> `boolean` **Boolean indicating if we upgrade the connection to TLS on the socks server**
|
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.9",
|
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.2",
|
37
|
+
"smart-buffer": "^1.0.4"
|
38
38
|
}
|
39
39
|
}
|