surgio 3.18.0 → 3.19.0
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/build/generator/artifact.js +12 -1
- package/build/generator/artifact.js.map +1 -1
- package/build/provider/ClashProvider.d.ts +2 -2
- package/build/provider/ClashProvider.js +125 -0
- package/build/provider/ClashProvider.js.map +1 -1
- package/build/provider/CustomProvider.js +27 -23
- package/build/provider/CustomProvider.js.map +1 -1
- package/build/types.d.ts +9 -3
- package/build/types.js +2 -0
- package/build/types.js.map +1 -1
- package/build/utils/clash.js +137 -1
- package/build/utils/clash.js.map +1 -1
- package/build/utils/surge.js +43 -0
- package/build/utils/surge.js.map +1 -1
- package/build/validators/index.d.ts +2 -0
- package/build/validators/index.js +2 -0
- package/build/validators/index.js.map +1 -1
- package/build/validators/masque.d.ts +633 -0
- package/build/validators/masque.js +83 -0
- package/build/validators/masque.js.map +1 -0
- package/build/validators/trust-tunnel.d.ts +338 -0
- package/build/validators/trust-tunnel.js +62 -0
- package/build/validators/trust-tunnel.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MasqueNodeConfigValidator = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const MasqueTlsNodeConfigValidator = common_1.TlsNodeConfigValidator.omit({
|
|
8
|
+
tls13: true,
|
|
9
|
+
});
|
|
10
|
+
const MasqueBasicAuthNodeConfigValidator = MasqueTlsNodeConfigValidator.extend({
|
|
11
|
+
type: zod_1.z.literal(types_1.NodeTypeEnum.Masque),
|
|
12
|
+
authMode: zod_1.z.literal('basic-auth'),
|
|
13
|
+
username: zod_1.z.string().optional(),
|
|
14
|
+
password: zod_1.z.string().optional(),
|
|
15
|
+
});
|
|
16
|
+
const MasqueKeyPairNodeConfigValidator = MasqueTlsNodeConfigValidator.extend({
|
|
17
|
+
type: zod_1.z.literal(types_1.NodeTypeEnum.Masque),
|
|
18
|
+
authMode: zod_1.z.literal('key-pair'),
|
|
19
|
+
privateKey: zod_1.z.string().min(1),
|
|
20
|
+
publicKey: zod_1.z.string().min(1),
|
|
21
|
+
ip: zod_1.z.string().min(1).optional(),
|
|
22
|
+
ipv6: zod_1.z.string().min(1).optional(),
|
|
23
|
+
dnsServers: zod_1.z.array(zod_1.z.string().min(1)).nonempty().optional(),
|
|
24
|
+
network: zod_1.z.enum(['h3', 'h2', 'h3-l4proxy']).optional(),
|
|
25
|
+
sni: zod_1.z.string().optional(),
|
|
26
|
+
connectUri: zod_1.z
|
|
27
|
+
.string()
|
|
28
|
+
.url()
|
|
29
|
+
.refine((value) => value.startsWith('https://'), {
|
|
30
|
+
message: 'connectUri 必须为 HTTPS URL',
|
|
31
|
+
})
|
|
32
|
+
.optional(),
|
|
33
|
+
mtu: zod_1.z.number().int().min(1280).max(1500).optional(),
|
|
34
|
+
keepalive: zod_1.z.number().int().nonnegative().optional(),
|
|
35
|
+
udpRelay: zod_1.z.boolean().optional(),
|
|
36
|
+
remoteDnsResolve: zod_1.z.boolean().optional(),
|
|
37
|
+
congestionController: zod_1.z.literal('bbr').optional(),
|
|
38
|
+
bbrProfile: zod_1.z.enum(['standard', 'conservative', 'aggressive']).optional(),
|
|
39
|
+
handshakeTimeout: zod_1.z.number().int().nonnegative().optional(),
|
|
40
|
+
});
|
|
41
|
+
exports.MasqueNodeConfigValidator = zod_1.z
|
|
42
|
+
.discriminatedUnion('authMode', [
|
|
43
|
+
MasqueBasicAuthNodeConfigValidator,
|
|
44
|
+
MasqueKeyPairNodeConfigValidator,
|
|
45
|
+
])
|
|
46
|
+
.superRefine((node, ctx) => {
|
|
47
|
+
if (node.shadowTls) {
|
|
48
|
+
ctx.addIssue({
|
|
49
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
50
|
+
message: 'MASQUE 不支持 Shadow TLS',
|
|
51
|
+
path: ['shadowTls'],
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (node.authMode === 'basic-auth' &&
|
|
55
|
+
node.portHopping &&
|
|
56
|
+
node.underlyingProxy) {
|
|
57
|
+
ctx.addIssue({
|
|
58
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
59
|
+
message: 'MASQUE 的 portHopping 不能与 underlyingProxy 同时使用',
|
|
60
|
+
path: ['underlyingProxy'],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (node.authMode === 'key-pair' &&
|
|
64
|
+
node.network !== 'h3-l4proxy' &&
|
|
65
|
+
!node.ip &&
|
|
66
|
+
!node.ipv6) {
|
|
67
|
+
ctx.addIssue({
|
|
68
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
69
|
+
message: 'MASQUE key-pair 节点必须配置 ip 或 ipv6',
|
|
70
|
+
path: ['ip'],
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (node.authMode === 'key-pair' &&
|
|
74
|
+
node.network === 'h3-l4proxy' &&
|
|
75
|
+
node.udpRelay === true) {
|
|
76
|
+
ctx.addIssue({
|
|
77
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
78
|
+
message: 'MASQUE h3-l4proxy 模式不支持 UDP',
|
|
79
|
+
path: ['udpRelay'],
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=masque.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masque.js","sourceRoot":"","sources":["../../src/validators/masque.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEvB,oCAAuC;AAEvC,qCAAiD;AAEjD,MAAM,4BAA4B,GAAG,+BAAsB,CAAC,IAAI,CAAC;IAC/D,KAAK,EAAE,IAAI;CACZ,CAAC,CAAA;AAEF,MAAM,kCAAkC,GAAG,4BAA4B,CAAC,MAAM,CAAC;IAC7E,IAAI,EAAE,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,OAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,+CAA+C;YACxD,IAAI,EAAE,CAAC,iBAAiB,CAAC;SAC1B,CAAC,CAAA;IACJ,CAAC;IAED,IACE,IAAI,CAAC,QAAQ,KAAK,UAAU;QAC5B,IAAI,CAAC,OAAO,KAAK,YAAY;QAC7B,CAAC,IAAI,CAAC,EAAE;QACR,CAAC,IAAI,CAAC,IAAI,EACV,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,kCAAkC;YAC3C,IAAI,EAAE,CAAC,IAAI,CAAC;SACb,CAAC,CAAA;IACJ,CAAC;IAED,IACE,IAAI,CAAC,QAAQ,KAAK,UAAU;QAC5B,IAAI,CAAC,OAAO,KAAK,YAAY;QAC7B,IAAI,CAAC,QAAQ,KAAK,IAAI,EACtB,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,6BAA6B;YACtC,IAAI,EAAE,CAAC,UAAU,CAAC;SACnB,CAAC,CAAA;IACJ,CAAC;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { NodeTypeEnum } from '../types';
|
|
3
|
+
export declare const TrustTunnelNodeConfigValidator: z.ZodEffects<z.ZodObject<{
|
|
4
|
+
nodeName: z.ZodString;
|
|
5
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
tfo: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
mptcp: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
ecn: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
shadowTls: z.ZodOptional<z.ZodObject<{
|
|
10
|
+
version: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string | number, string | number>>;
|
|
11
|
+
password: z.ZodString;
|
|
12
|
+
sni: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
password: string;
|
|
15
|
+
sni: string;
|
|
16
|
+
version?: string | number | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
password: string;
|
|
19
|
+
sni: string;
|
|
20
|
+
version?: string | number | undefined;
|
|
21
|
+
}>>;
|
|
22
|
+
blockQuic: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"auto">, z.ZodLiteral<"on">, z.ZodLiteral<"off">]>>;
|
|
23
|
+
portHopping: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
24
|
+
portHoppingInterval: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
underlyingProxy: z.ZodOptional<z.ZodString>;
|
|
26
|
+
testUrl: z.ZodOptional<z.ZodString>;
|
|
27
|
+
testTimeout: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
surgeConfig: z.ZodOptional<z.ZodObject<{
|
|
29
|
+
resolveHostname: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
vmessAEAD: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
resolveHostname?: boolean | undefined;
|
|
33
|
+
vmessAEAD?: boolean | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
resolveHostname?: boolean | undefined;
|
|
36
|
+
vmessAEAD?: boolean | undefined;
|
|
37
|
+
}>>;
|
|
38
|
+
surfboardConfig: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
vmessAEAD: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
vmessAEAD?: boolean | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
vmessAEAD?: boolean | undefined;
|
|
44
|
+
}>>;
|
|
45
|
+
quantumultXConfig: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
vmessAEAD: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
vmessAEAD?: boolean | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
vmessAEAD?: boolean | undefined;
|
|
51
|
+
}>>;
|
|
52
|
+
clashConfig: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
enableTuic: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
enableShadowTls: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
enableHysteria2: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
enableVless: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
+
clashCore: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"clash">, z.ZodLiteral<"clash.meta">, z.ZodLiteral<"stash">]>>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
enableTuic?: boolean | undefined;
|
|
60
|
+
enableShadowTls?: boolean | undefined;
|
|
61
|
+
enableHysteria2?: boolean | undefined;
|
|
62
|
+
enableVless?: boolean | undefined;
|
|
63
|
+
clashCore?: "clash" | "clash.meta" | "stash" | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
enableTuic?: boolean | undefined;
|
|
66
|
+
enableShadowTls?: boolean | undefined;
|
|
67
|
+
enableHysteria2?: boolean | undefined;
|
|
68
|
+
enableVless?: boolean | undefined;
|
|
69
|
+
clashCore?: "clash" | "clash.meta" | "stash" | undefined;
|
|
70
|
+
}>>;
|
|
71
|
+
hostnameIp: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
|
|
72
|
+
binPath: z.ZodOptional<z.ZodString>;
|
|
73
|
+
localPort: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
interfaceName: z.ZodOptional<z.ZodString>;
|
|
75
|
+
ipVersion: z.ZodOptional<z.ZodString>;
|
|
76
|
+
hostname: z.ZodString;
|
|
77
|
+
port: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string | number, string | number>;
|
|
78
|
+
tls13: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
+
skipCertVerify: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
sni: z.ZodOptional<z.ZodString>;
|
|
81
|
+
alpn: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
|
|
82
|
+
serverCertFingerprintSha256: z.ZodOptional<z.ZodString>;
|
|
83
|
+
clientFingerprint: z.ZodOptional<z.ZodString>;
|
|
84
|
+
} & {
|
|
85
|
+
type: z.ZodLiteral<NodeTypeEnum.TrustTunnel>;
|
|
86
|
+
username: z.ZodString;
|
|
87
|
+
password: z.ZodString;
|
|
88
|
+
quic: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
udpRelay: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
91
|
+
healthCheck: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
nameCertVerify: z.ZodOptional<z.ZodString>;
|
|
93
|
+
congestionController: z.ZodOptional<z.ZodString>;
|
|
94
|
+
bbrProfile: z.ZodOptional<z.ZodEnum<["standard", "conservative", "aggressive"]>>;
|
|
95
|
+
maxConnections: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
minStreams: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
maxStreams: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
port: string | number;
|
|
100
|
+
type: NodeTypeEnum.TrustTunnel;
|
|
101
|
+
nodeName: string;
|
|
102
|
+
password: string;
|
|
103
|
+
hostname: string;
|
|
104
|
+
username: string;
|
|
105
|
+
enable?: boolean | undefined;
|
|
106
|
+
tfo?: boolean | undefined;
|
|
107
|
+
mptcp?: boolean | undefined;
|
|
108
|
+
ecn?: boolean | undefined;
|
|
109
|
+
sni?: string | undefined;
|
|
110
|
+
shadowTls?: {
|
|
111
|
+
password: string;
|
|
112
|
+
sni: string;
|
|
113
|
+
version?: string | number | undefined;
|
|
114
|
+
} | undefined;
|
|
115
|
+
blockQuic?: "auto" | "on" | "off" | undefined;
|
|
116
|
+
portHopping?: string | undefined;
|
|
117
|
+
portHoppingInterval?: number | undefined;
|
|
118
|
+
underlyingProxy?: string | undefined;
|
|
119
|
+
testUrl?: string | undefined;
|
|
120
|
+
testTimeout?: number | undefined;
|
|
121
|
+
surgeConfig?: {
|
|
122
|
+
resolveHostname?: boolean | undefined;
|
|
123
|
+
vmessAEAD?: boolean | undefined;
|
|
124
|
+
} | undefined;
|
|
125
|
+
surfboardConfig?: {
|
|
126
|
+
vmessAEAD?: boolean | undefined;
|
|
127
|
+
} | undefined;
|
|
128
|
+
quantumultXConfig?: {
|
|
129
|
+
vmessAEAD?: boolean | undefined;
|
|
130
|
+
} | undefined;
|
|
131
|
+
clashConfig?: {
|
|
132
|
+
enableTuic?: boolean | undefined;
|
|
133
|
+
enableShadowTls?: boolean | undefined;
|
|
134
|
+
enableHysteria2?: boolean | undefined;
|
|
135
|
+
enableVless?: boolean | undefined;
|
|
136
|
+
clashCore?: "clash" | "clash.meta" | "stash" | undefined;
|
|
137
|
+
} | undefined;
|
|
138
|
+
hostnameIp?: readonly string[] | undefined;
|
|
139
|
+
binPath?: string | undefined;
|
|
140
|
+
localPort?: number | undefined;
|
|
141
|
+
interfaceName?: string | undefined;
|
|
142
|
+
ipVersion?: string | undefined;
|
|
143
|
+
tls13?: boolean | undefined;
|
|
144
|
+
skipCertVerify?: boolean | undefined;
|
|
145
|
+
alpn?: [string, ...string[]] | undefined;
|
|
146
|
+
serverCertFingerprintSha256?: string | undefined;
|
|
147
|
+
clientFingerprint?: string | undefined;
|
|
148
|
+
headers?: Record<string, string> | undefined;
|
|
149
|
+
udpRelay?: boolean | undefined;
|
|
150
|
+
quic?: boolean | undefined;
|
|
151
|
+
maxConnections?: number | undefined;
|
|
152
|
+
minStreams?: number | undefined;
|
|
153
|
+
maxStreams?: number | undefined;
|
|
154
|
+
congestionController?: string | undefined;
|
|
155
|
+
bbrProfile?: "standard" | "conservative" | "aggressive" | undefined;
|
|
156
|
+
healthCheck?: boolean | undefined;
|
|
157
|
+
nameCertVerify?: string | undefined;
|
|
158
|
+
}, {
|
|
159
|
+
port: string | number;
|
|
160
|
+
type: NodeTypeEnum.TrustTunnel;
|
|
161
|
+
nodeName: string;
|
|
162
|
+
password: string;
|
|
163
|
+
hostname: string;
|
|
164
|
+
username: string;
|
|
165
|
+
enable?: boolean | undefined;
|
|
166
|
+
tfo?: boolean | undefined;
|
|
167
|
+
mptcp?: boolean | undefined;
|
|
168
|
+
ecn?: boolean | undefined;
|
|
169
|
+
sni?: string | undefined;
|
|
170
|
+
shadowTls?: {
|
|
171
|
+
password: string;
|
|
172
|
+
sni: string;
|
|
173
|
+
version?: string | number | undefined;
|
|
174
|
+
} | undefined;
|
|
175
|
+
blockQuic?: "auto" | "on" | "off" | undefined;
|
|
176
|
+
portHopping?: string | undefined;
|
|
177
|
+
portHoppingInterval?: number | undefined;
|
|
178
|
+
underlyingProxy?: string | undefined;
|
|
179
|
+
testUrl?: string | undefined;
|
|
180
|
+
testTimeout?: number | undefined;
|
|
181
|
+
surgeConfig?: {
|
|
182
|
+
resolveHostname?: boolean | undefined;
|
|
183
|
+
vmessAEAD?: boolean | undefined;
|
|
184
|
+
} | undefined;
|
|
185
|
+
surfboardConfig?: {
|
|
186
|
+
vmessAEAD?: boolean | undefined;
|
|
187
|
+
} | undefined;
|
|
188
|
+
quantumultXConfig?: {
|
|
189
|
+
vmessAEAD?: boolean | undefined;
|
|
190
|
+
} | undefined;
|
|
191
|
+
clashConfig?: {
|
|
192
|
+
enableTuic?: boolean | undefined;
|
|
193
|
+
enableShadowTls?: boolean | undefined;
|
|
194
|
+
enableHysteria2?: boolean | undefined;
|
|
195
|
+
enableVless?: boolean | undefined;
|
|
196
|
+
clashCore?: "clash" | "clash.meta" | "stash" | undefined;
|
|
197
|
+
} | undefined;
|
|
198
|
+
hostnameIp?: readonly string[] | undefined;
|
|
199
|
+
binPath?: string | undefined;
|
|
200
|
+
localPort?: number | undefined;
|
|
201
|
+
interfaceName?: string | undefined;
|
|
202
|
+
ipVersion?: string | undefined;
|
|
203
|
+
tls13?: boolean | undefined;
|
|
204
|
+
skipCertVerify?: boolean | undefined;
|
|
205
|
+
alpn?: [string, ...string[]] | undefined;
|
|
206
|
+
serverCertFingerprintSha256?: string | undefined;
|
|
207
|
+
clientFingerprint?: string | undefined;
|
|
208
|
+
headers?: Record<string, string> | undefined;
|
|
209
|
+
udpRelay?: boolean | undefined;
|
|
210
|
+
quic?: boolean | undefined;
|
|
211
|
+
maxConnections?: number | undefined;
|
|
212
|
+
minStreams?: number | undefined;
|
|
213
|
+
maxStreams?: number | undefined;
|
|
214
|
+
congestionController?: string | undefined;
|
|
215
|
+
bbrProfile?: "standard" | "conservative" | "aggressive" | undefined;
|
|
216
|
+
healthCheck?: boolean | undefined;
|
|
217
|
+
nameCertVerify?: string | undefined;
|
|
218
|
+
}>, {
|
|
219
|
+
port: string | number;
|
|
220
|
+
type: NodeTypeEnum.TrustTunnel;
|
|
221
|
+
nodeName: string;
|
|
222
|
+
password: string;
|
|
223
|
+
hostname: string;
|
|
224
|
+
username: string;
|
|
225
|
+
enable?: boolean | undefined;
|
|
226
|
+
tfo?: boolean | undefined;
|
|
227
|
+
mptcp?: boolean | undefined;
|
|
228
|
+
ecn?: boolean | undefined;
|
|
229
|
+
sni?: string | undefined;
|
|
230
|
+
shadowTls?: {
|
|
231
|
+
password: string;
|
|
232
|
+
sni: string;
|
|
233
|
+
version?: string | number | undefined;
|
|
234
|
+
} | undefined;
|
|
235
|
+
blockQuic?: "auto" | "on" | "off" | undefined;
|
|
236
|
+
portHopping?: string | undefined;
|
|
237
|
+
portHoppingInterval?: number | undefined;
|
|
238
|
+
underlyingProxy?: string | undefined;
|
|
239
|
+
testUrl?: string | undefined;
|
|
240
|
+
testTimeout?: number | undefined;
|
|
241
|
+
surgeConfig?: {
|
|
242
|
+
resolveHostname?: boolean | undefined;
|
|
243
|
+
vmessAEAD?: boolean | undefined;
|
|
244
|
+
} | undefined;
|
|
245
|
+
surfboardConfig?: {
|
|
246
|
+
vmessAEAD?: boolean | undefined;
|
|
247
|
+
} | undefined;
|
|
248
|
+
quantumultXConfig?: {
|
|
249
|
+
vmessAEAD?: boolean | undefined;
|
|
250
|
+
} | undefined;
|
|
251
|
+
clashConfig?: {
|
|
252
|
+
enableTuic?: boolean | undefined;
|
|
253
|
+
enableShadowTls?: boolean | undefined;
|
|
254
|
+
enableHysteria2?: boolean | undefined;
|
|
255
|
+
enableVless?: boolean | undefined;
|
|
256
|
+
clashCore?: "clash" | "clash.meta" | "stash" | undefined;
|
|
257
|
+
} | undefined;
|
|
258
|
+
hostnameIp?: readonly string[] | undefined;
|
|
259
|
+
binPath?: string | undefined;
|
|
260
|
+
localPort?: number | undefined;
|
|
261
|
+
interfaceName?: string | undefined;
|
|
262
|
+
ipVersion?: string | undefined;
|
|
263
|
+
tls13?: boolean | undefined;
|
|
264
|
+
skipCertVerify?: boolean | undefined;
|
|
265
|
+
alpn?: [string, ...string[]] | undefined;
|
|
266
|
+
serverCertFingerprintSha256?: string | undefined;
|
|
267
|
+
clientFingerprint?: string | undefined;
|
|
268
|
+
headers?: Record<string, string> | undefined;
|
|
269
|
+
udpRelay?: boolean | undefined;
|
|
270
|
+
quic?: boolean | undefined;
|
|
271
|
+
maxConnections?: number | undefined;
|
|
272
|
+
minStreams?: number | undefined;
|
|
273
|
+
maxStreams?: number | undefined;
|
|
274
|
+
congestionController?: string | undefined;
|
|
275
|
+
bbrProfile?: "standard" | "conservative" | "aggressive" | undefined;
|
|
276
|
+
healthCheck?: boolean | undefined;
|
|
277
|
+
nameCertVerify?: string | undefined;
|
|
278
|
+
}, {
|
|
279
|
+
port: string | number;
|
|
280
|
+
type: NodeTypeEnum.TrustTunnel;
|
|
281
|
+
nodeName: string;
|
|
282
|
+
password: string;
|
|
283
|
+
hostname: string;
|
|
284
|
+
username: string;
|
|
285
|
+
enable?: boolean | undefined;
|
|
286
|
+
tfo?: boolean | undefined;
|
|
287
|
+
mptcp?: boolean | undefined;
|
|
288
|
+
ecn?: boolean | undefined;
|
|
289
|
+
sni?: string | undefined;
|
|
290
|
+
shadowTls?: {
|
|
291
|
+
password: string;
|
|
292
|
+
sni: string;
|
|
293
|
+
version?: string | number | undefined;
|
|
294
|
+
} | undefined;
|
|
295
|
+
blockQuic?: "auto" | "on" | "off" | undefined;
|
|
296
|
+
portHopping?: string | undefined;
|
|
297
|
+
portHoppingInterval?: number | undefined;
|
|
298
|
+
underlyingProxy?: string | undefined;
|
|
299
|
+
testUrl?: string | undefined;
|
|
300
|
+
testTimeout?: number | undefined;
|
|
301
|
+
surgeConfig?: {
|
|
302
|
+
resolveHostname?: boolean | undefined;
|
|
303
|
+
vmessAEAD?: boolean | undefined;
|
|
304
|
+
} | undefined;
|
|
305
|
+
surfboardConfig?: {
|
|
306
|
+
vmessAEAD?: boolean | undefined;
|
|
307
|
+
} | undefined;
|
|
308
|
+
quantumultXConfig?: {
|
|
309
|
+
vmessAEAD?: boolean | undefined;
|
|
310
|
+
} | undefined;
|
|
311
|
+
clashConfig?: {
|
|
312
|
+
enableTuic?: boolean | undefined;
|
|
313
|
+
enableShadowTls?: boolean | undefined;
|
|
314
|
+
enableHysteria2?: boolean | undefined;
|
|
315
|
+
enableVless?: boolean | undefined;
|
|
316
|
+
clashCore?: "clash" | "clash.meta" | "stash" | undefined;
|
|
317
|
+
} | undefined;
|
|
318
|
+
hostnameIp?: readonly string[] | undefined;
|
|
319
|
+
binPath?: string | undefined;
|
|
320
|
+
localPort?: number | undefined;
|
|
321
|
+
interfaceName?: string | undefined;
|
|
322
|
+
ipVersion?: string | undefined;
|
|
323
|
+
tls13?: boolean | undefined;
|
|
324
|
+
skipCertVerify?: boolean | undefined;
|
|
325
|
+
alpn?: [string, ...string[]] | undefined;
|
|
326
|
+
serverCertFingerprintSha256?: string | undefined;
|
|
327
|
+
clientFingerprint?: string | undefined;
|
|
328
|
+
headers?: Record<string, string> | undefined;
|
|
329
|
+
udpRelay?: boolean | undefined;
|
|
330
|
+
quic?: boolean | undefined;
|
|
331
|
+
maxConnections?: number | undefined;
|
|
332
|
+
minStreams?: number | undefined;
|
|
333
|
+
maxStreams?: number | undefined;
|
|
334
|
+
congestionController?: string | undefined;
|
|
335
|
+
bbrProfile?: "standard" | "conservative" | "aggressive" | undefined;
|
|
336
|
+
healthCheck?: boolean | undefined;
|
|
337
|
+
nameCertVerify?: string | undefined;
|
|
338
|
+
}>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrustTunnelNodeConfigValidator = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
exports.TrustTunnelNodeConfigValidator = common_1.TlsNodeConfigValidator.extend({
|
|
8
|
+
type: zod_1.z.literal(types_1.NodeTypeEnum.TrustTunnel),
|
|
9
|
+
username: zod_1.z.string(),
|
|
10
|
+
password: zod_1.z.string(),
|
|
11
|
+
quic: zod_1.z.oboolean(),
|
|
12
|
+
udpRelay: zod_1.z.oboolean(),
|
|
13
|
+
headers: zod_1.z.record(zod_1.z.string()).optional(),
|
|
14
|
+
healthCheck: zod_1.z.oboolean(),
|
|
15
|
+
nameCertVerify: zod_1.z.ostring(),
|
|
16
|
+
congestionController: zod_1.z.string().min(1).optional(),
|
|
17
|
+
bbrProfile: zod_1.z.enum(['standard', 'conservative', 'aggressive']).optional(),
|
|
18
|
+
maxConnections: zod_1.z.number().int().nonnegative().optional(),
|
|
19
|
+
minStreams: zod_1.z.number().int().nonnegative().optional(),
|
|
20
|
+
maxStreams: zod_1.z.number().int().nonnegative().optional(),
|
|
21
|
+
}).superRefine((node, ctx) => {
|
|
22
|
+
const requiredAlpn = node.quic ? 'h3' : 'h2';
|
|
23
|
+
if (node.alpn && !node.alpn.includes(requiredAlpn)) {
|
|
24
|
+
ctx.addIssue({
|
|
25
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
26
|
+
message: `TrustTunnel ${node.quic ? 'QUIC' : 'HTTP/2'} 模式的 alpn 必须包含 ${requiredAlpn}`,
|
|
27
|
+
path: ['alpn'],
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (!node.quic &&
|
|
31
|
+
(node.portHopping || node.portHoppingInterval !== undefined)) {
|
|
32
|
+
ctx.addIssue({
|
|
33
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
34
|
+
message: 'TrustTunnel 仅在 QUIC 模式下支持端口跳跃',
|
|
35
|
+
path: ['portHopping'],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (!node.quic &&
|
|
39
|
+
(node.congestionController !== undefined || node.bbrProfile !== undefined)) {
|
|
40
|
+
ctx.addIssue({
|
|
41
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
42
|
+
message: 'TrustTunnel 仅在 QUIC 模式下支持拥塞控制参数',
|
|
43
|
+
path: ['congestionController'],
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (node.quic && node.shadowTls) {
|
|
47
|
+
ctx.addIssue({
|
|
48
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
49
|
+
message: 'TrustTunnel QUIC 模式不支持 Shadow TLS',
|
|
50
|
+
path: ['shadowTls'],
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (node.maxStreams !== undefined &&
|
|
54
|
+
(node.maxConnections !== undefined || node.minStreams !== undefined)) {
|
|
55
|
+
ctx.addIssue({
|
|
56
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
57
|
+
message: 'TrustTunnel 的 maxStreams 不能与 maxConnections 或 minStreams 同时配置',
|
|
58
|
+
path: ['maxStreams'],
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=trust-tunnel.js.map
|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