socks 2.6.0-beta.1 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +20 -6
- package/package.json +1 -1
package/README.md
CHANGED
@@ -4,11 +4,12 @@ Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Inc
|
|
4
4
|
|
5
5
|
### Features
|
6
6
|
|
7
|
-
* Supports SOCKS v4, v4a, and
|
7
|
+
* Supports SOCKS v4, v4a, v5, and v5h protocols.
|
8
8
|
* Supports the CONNECT, BIND, and ASSOCIATE commands.
|
9
9
|
* Supports callbacks, promises, and events for proxy connection creation async flow control.
|
10
10
|
* Supports proxy chaining (CONNECT only).
|
11
|
-
* Supports user/
|
11
|
+
* Supports user/password authentication.
|
12
|
+
* Supports custom authentication.
|
12
13
|
* Built in UDP frame creation & parse functions.
|
13
14
|
* Created with TypeScript, type definitions are provided.
|
14
15
|
|
@@ -396,17 +397,19 @@ Looking for a guide to migrate from v1? Look [here](docs/migratingFromV1.md)
|
|
396
397
|
|
397
398
|
### SocksClient
|
398
399
|
|
399
|
-
SocksClient establishes SOCKS proxy connections to remote destination hosts. These proxy connections are fully transparent to the server and once established act as full duplex streams. SOCKS v4, v4a, and
|
400
|
+
SocksClient establishes SOCKS proxy connections to remote destination hosts. These proxy connections are fully transparent to the server and once established act as full duplex streams. SOCKS v4, v4a, v5, and v5h are supported, as well as the connect, bind, and associate commands.
|
400
401
|
|
401
402
|
SocksClient supports creating connections using callbacks, promises, and async/await flow control using two static factory functions createConnection and createConnectionChain. It also internally extends EventEmitter which results in allowing event handling based async flow control.
|
402
403
|
|
403
404
|
**SOCKS Compatibility Table**
|
404
405
|
|
406
|
+
Note: When using 4a please specify type: 4, and when using 5h please specify type 5.
|
407
|
+
|
405
408
|
| Socks Version | TCP | UDP | IPv4 | IPv6 | Hostname |
|
406
409
|
| --- | :---: | :---: | :---: | :---: | :---: |
|
407
410
|
| SOCKS v4 | ✅ | ❌ | ✅ | ❌ | ❌ |
|
408
411
|
| SOCKS v4a | ✅ | ❌ | ✅ | ❌ | ✅ |
|
409
|
-
| SOCKS v5 | ✅ | ✅ | ✅ | ✅ | ✅ |
|
412
|
+
| SOCKS v5 (includes 5hh) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
410
413
|
|
411
414
|
### new SocksClient(options)
|
412
415
|
|
@@ -419,11 +422,22 @@ SocksClient supports creating connections using callbacks, promises, and async/a
|
|
419
422
|
proxy: {
|
420
423
|
host: '159.203.75.200', // ipv4, ipv6, or hostname
|
421
424
|
port: 1080,
|
422
|
-
type: 5 // Proxy version (4 or 5). For v4a,
|
425
|
+
type: 5 // Proxy version (4 or 5). For v4a use 4, for v5h use 5.
|
423
426
|
|
424
427
|
// Optional fields
|
425
428
|
userId: 'some username', // Used for SOCKS4 userId auth, and SOCKS5 user/pass auth in conjunction with password.
|
426
|
-
password: 'some password' // Used in conjunction with userId for user/pass auth for SOCKS5 proxies.
|
429
|
+
password: 'some password', // Used in conjunction with userId for user/pass auth for SOCKS5 proxies.
|
430
|
+
custom_auth_method: 0x80, // If using a custom auth method, specify the type here. If this is set, ALL other custom_auth_*** options must be set as well.
|
431
|
+
custom_auth_request_handler: async () =>. {
|
432
|
+
// This will be called when it's time to send the custom auth handshake. You must return a Buffer containing the data to send as your authentication.
|
433
|
+
return Buffer.from([0x01,0x02,0x03]);
|
434
|
+
},
|
435
|
+
// This is the expected size (bytes) of the custom auth response from the proxy server.
|
436
|
+
custom_auth_response_size: 2,
|
437
|
+
// This is called when the auth response is received. The received packet is passed in as a Buffer, and you must return a boolean indicating the response from the server said your custom auth was successful or failed.
|
438
|
+
custom_auth_response_handler: async (data) => {
|
439
|
+
return data[1] === 0x00;
|
440
|
+
}
|
427
441
|
},
|
428
442
|
|
429
443
|
command: 'connect', // connect, bind, associate
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "socks",
|
3
3
|
"private": false,
|
4
|
-
"version": "2.6.0
|
4
|
+
"version": "2.6.0",
|
5
5
|
"description": "Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.",
|
6
6
|
"main": "build/index.js",
|
7
7
|
"typings": "typings/index.d.ts",
|