ddan-js 2.6.43 → 2.6.45
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/LICENSE +7 -7
- package/README.md +10 -10
- package/bin/ddan-js.esm.js +1 -1
- package/bin/ddan-js.js +1 -1
- package/bin/lib/modules/node/socks5.js +29 -23
- package/bin/lib/modules/rule/async-validator/rule/url.js +11 -11
- package/bin/types/modules/node/socks5.d.ts +16 -2
- package/bin/types/modules/rule/async-validator/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -12,17 +12,17 @@ exports.default = () => {
|
|
|
12
12
|
: '';
|
|
13
13
|
const v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}';
|
|
14
14
|
const v6seg = '[a-fA-F\\d]{1,4}';
|
|
15
|
-
const v6 = `
|
|
16
|
-
(?:
|
|
17
|
-
(?:${v6seg}:){7}(?:${v6seg}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
18
|
-
(?:${v6seg}:){6}(?:${v4}|:${v6seg}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
19
|
-
(?:${v6seg}:){5}(?::${v4}|(?::${v6seg}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
20
|
-
(?:${v6seg}:){4}(?:(?::${v6seg}){0,1}:${v4}|(?::${v6seg}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
21
|
-
(?:${v6seg}:){3}(?:(?::${v6seg}){0,2}:${v4}|(?::${v6seg}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
22
|
-
(?:${v6seg}:){2}(?:(?::${v6seg}){0,3}:${v4}|(?::${v6seg}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
23
|
-
(?:${v6seg}:){1}(?:(?::${v6seg}){0,4}:${v4}|(?::${v6seg}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
24
|
-
(?::(?:(?::${v6seg}){0,5}:${v4}|(?::${v6seg}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
25
|
-
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
15
|
+
const v6 = `
|
|
16
|
+
(?:
|
|
17
|
+
(?:${v6seg}:){7}(?:${v6seg}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
18
|
+
(?:${v6seg}:){6}(?:${v4}|:${v6seg}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
19
|
+
(?:${v6seg}:){5}(?::${v4}|(?::${v6seg}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
20
|
+
(?:${v6seg}:){4}(?:(?::${v6seg}){0,1}:${v4}|(?::${v6seg}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
21
|
+
(?:${v6seg}:){3}(?:(?::${v6seg}){0,2}:${v4}|(?::${v6seg}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
22
|
+
(?:${v6seg}:){2}(?:(?::${v6seg}){0,3}:${v4}|(?::${v6seg}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
23
|
+
(?:${v6seg}:){1}(?:(?::${v6seg}){0,4}:${v4}|(?::${v6seg}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
24
|
+
(?::(?:(?::${v6seg}){0,5}:${v4}|(?::${v6seg}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
25
|
+
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
26
26
|
`
|
|
27
27
|
.replace(/\s*\/\/.*$/gm, '')
|
|
28
28
|
.replace(/\n/g, '')
|
|
@@ -31,9 +31,14 @@ export declare class Socks5 {
|
|
|
31
31
|
setUpstreamProxy(upstreamProxy: IProxyConfig): boolean;
|
|
32
32
|
setSystemProxy(use: boolean, config?: IProxyConfig): void;
|
|
33
33
|
setAllowedDomains(allowedDomains?: string[]): void;
|
|
34
|
+
/**
|
|
35
|
+
* 查找可用端口
|
|
36
|
+
* @param startPort
|
|
37
|
+
* @param maxRetries
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
34
40
|
private findAvailablePort;
|
|
35
41
|
private handleSocksConnection;
|
|
36
|
-
private _handleSocksConnection;
|
|
37
42
|
/**
|
|
38
43
|
* 回复客户端请求响应数据
|
|
39
44
|
* VER是SOCKS版本,这里应该是0x05;
|
|
@@ -49,8 +54,17 @@ export declare class Socks5 {
|
|
|
49
54
|
* 0x08不支持的地址类型
|
|
50
55
|
* 0x09 - 0xFF未定义
|
|
51
56
|
*/
|
|
52
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* 握手
|
|
59
|
+
* @param clientSocket
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
53
62
|
private performHandshake;
|
|
63
|
+
/**
|
|
64
|
+
* 解析请求
|
|
65
|
+
* @param clientSocket
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
54
68
|
private parseClientRequest;
|
|
55
69
|
private connectToUpstreamProxy;
|
|
56
70
|
private connectToSystemProxy;
|
|
@@ -14,6 +14,12 @@ declare class Schema {
|
|
|
14
14
|
string: import("./interface").ExecuteValidator;
|
|
15
15
|
method: import("./interface").ExecuteValidator;
|
|
16
16
|
number: import("./interface").ExecuteValidator;
|
|
17
|
+
/**
|
|
18
|
+
* Encapsulates a validation schema.
|
|
19
|
+
*
|
|
20
|
+
* @param descriptor An object declaring validation rules
|
|
21
|
+
* for this schema.
|
|
22
|
+
*/
|
|
17
23
|
boolean: import("./interface").ExecuteValidator;
|
|
18
24
|
regexp: import("./interface").ExecuteValidator;
|
|
19
25
|
integer: import("./interface").ExecuteValidator;
|