nodelistparser 0.2.0 → 0.3.1
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/dist/cjs/index.d.ts +35 -8
- package/dist/cjs/index.js +33 -5
- package/dist/es/index.d.mts +35 -8
- package/dist/es/index.mjs +33 -5
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -52,13 +52,19 @@ interface TrojanBasicConfig extends SharedConfigBase, TlsSharedConfig {
|
|
|
52
52
|
/** udp-relay */
|
|
53
53
|
udp: boolean;
|
|
54
54
|
}
|
|
55
|
-
interface TuicConfig extends SharedConfigBase {
|
|
55
|
+
interface TuicConfig extends SharedConfigBase, TlsSharedConfig {
|
|
56
56
|
type: 'tuic';
|
|
57
57
|
sni: string;
|
|
58
58
|
uuid: string;
|
|
59
59
|
alpn: string;
|
|
60
|
+
token: string;
|
|
61
|
+
}
|
|
62
|
+
interface TuicV5Config extends SharedConfigBase, TlsSharedConfig {
|
|
63
|
+
type: 'tuic-v5';
|
|
64
|
+
sni: string;
|
|
65
|
+
uuid: string;
|
|
66
|
+
alpn: string;
|
|
60
67
|
password: string;
|
|
61
|
-
version: number;
|
|
62
68
|
}
|
|
63
69
|
interface Socks5Config extends SharedConfigBase {
|
|
64
70
|
type: 'socks5';
|
|
@@ -87,7 +93,7 @@ interface Hysteria2Config extends SharedConfigBase, Omit<TlsSharedConfig, 'sni'>
|
|
|
87
93
|
/** port hopping interval */
|
|
88
94
|
portHoppingInterval?: number;
|
|
89
95
|
}
|
|
90
|
-
type SupportedConfig = HttpProxyConfig | SnellConfig | TrojanConfig | ShadowSocksConfig | TuicConfig | Socks5Config | VmessConfig | Hysteria2Config;
|
|
96
|
+
type SupportedConfig = HttpProxyConfig | SnellConfig | TrojanConfig | ShadowSocksConfig | TuicConfig | TuicV5Config | Socks5Config | VmessConfig | Hysteria2Config;
|
|
91
97
|
|
|
92
98
|
declare function decode$1(raw: string): SupportedConfig;
|
|
93
99
|
declare function encode$1(config: SupportedConfig): string;
|
|
@@ -146,6 +152,9 @@ declare function encode(config: SupportedConfig): {
|
|
|
146
152
|
down?: undefined;
|
|
147
153
|
} | {
|
|
148
154
|
tfo: boolean | undefined;
|
|
155
|
+
'skip-cert-verify': boolean;
|
|
156
|
+
udp: boolean;
|
|
157
|
+
token: string;
|
|
149
158
|
name: string;
|
|
150
159
|
type: string;
|
|
151
160
|
server: string;
|
|
@@ -153,9 +162,6 @@ declare function encode(config: SupportedConfig): {
|
|
|
153
162
|
sni: string;
|
|
154
163
|
uuid: string;
|
|
155
164
|
alpn: string[];
|
|
156
|
-
token: string;
|
|
157
|
-
version: number;
|
|
158
|
-
udp: boolean;
|
|
159
165
|
alterId?: undefined;
|
|
160
166
|
tls?: undefined;
|
|
161
167
|
servername?: undefined;
|
|
@@ -167,7 +173,28 @@ declare function encode(config: SupportedConfig): {
|
|
|
167
173
|
ports?: undefined;
|
|
168
174
|
password?: undefined;
|
|
169
175
|
down?: undefined;
|
|
170
|
-
|
|
176
|
+
} | {
|
|
177
|
+
tfo: boolean | undefined;
|
|
178
|
+
'skip-cert-verify': boolean;
|
|
179
|
+
udp: boolean;
|
|
180
|
+
password: string;
|
|
181
|
+
name: string;
|
|
182
|
+
type: string;
|
|
183
|
+
server: string;
|
|
184
|
+
port: number;
|
|
185
|
+
sni: string;
|
|
186
|
+
uuid: string;
|
|
187
|
+
alpn: string[];
|
|
188
|
+
alterId?: undefined;
|
|
189
|
+
tls?: undefined;
|
|
190
|
+
servername?: undefined;
|
|
191
|
+
'ws-path'?: undefined;
|
|
192
|
+
'ws-headers'?: undefined;
|
|
193
|
+
cipher?: undefined;
|
|
194
|
+
'ws-opts'?: undefined;
|
|
195
|
+
network?: undefined;
|
|
196
|
+
ports?: undefined;
|
|
197
|
+
down?: undefined;
|
|
171
198
|
} | {
|
|
172
199
|
tfo: boolean | undefined;
|
|
173
200
|
name: string;
|
|
@@ -277,4 +304,4 @@ declare namespace index {
|
|
|
277
304
|
export { index_parse as parse };
|
|
278
305
|
}
|
|
279
306
|
|
|
280
|
-
export { type HttpProxyConfig, type Hysteria2Config, type ShadowSocksConfig, type SharedConfigBase, type SnellConfig, type Socks5Config, type SupportedConfig, type TrojanBasicConfig, type TrojanConfig, type TuicConfig, type VmessConfig, index$2 as clash, index$1 as ss, index$3 as surge, index as trojan };
|
|
307
|
+
export { type HttpProxyConfig, type Hysteria2Config, type ShadowSocksConfig, type SharedConfigBase, type SnellConfig, type Socks5Config, type SupportedConfig, type TrojanBasicConfig, type TrojanConfig, type TuicConfig, type TuicV5Config, type VmessConfig, index$2 as clash, index$1 as ss, index$3 as surge, index as trojan };
|
package/dist/cjs/index.js
CHANGED
|
@@ -46,7 +46,8 @@ const strKeys = new Set([
|
|
|
46
46
|
'block-quic',
|
|
47
47
|
'ws-path',
|
|
48
48
|
'ws-headers',
|
|
49
|
-
'port-hopping'
|
|
49
|
+
'port-hopping',
|
|
50
|
+
'token'
|
|
50
51
|
]);
|
|
51
52
|
const isProxyStrKey = (key)=>strKeys.has(key);
|
|
52
53
|
const UNSUPPORTED_VALUE = Symbol('unsupported');
|
|
@@ -143,8 +144,20 @@ function decode$1(raw) {
|
|
|
143
144
|
sni: restDetails.sni,
|
|
144
145
|
uuid: restDetails.uuid,
|
|
145
146
|
alpn: restDetails.alpn,
|
|
147
|
+
token: restDetails.token,
|
|
148
|
+
skipCertVerify: restDetails['skip-cert-verify'],
|
|
149
|
+
...shared
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
case 'tuic-v5':
|
|
153
|
+
{
|
|
154
|
+
return {
|
|
155
|
+
type: 'tuic-v5',
|
|
156
|
+
uuid: restDetails.uuid,
|
|
157
|
+
alpn: restDetails.alpn,
|
|
146
158
|
password: restDetails.password,
|
|
147
|
-
|
|
159
|
+
sni: restDetails.sni,
|
|
160
|
+
skipCertVerify: restDetails['skip-cert-verify'],
|
|
148
161
|
...shared
|
|
149
162
|
};
|
|
150
163
|
}
|
|
@@ -232,7 +245,7 @@ function encode$1(config) {
|
|
|
232
245
|
]);
|
|
233
246
|
case 'tuic':
|
|
234
247
|
return joinString([
|
|
235
|
-
`${config.name} = tuic, ${config.server}, ${config.port}, sni=${config.sni}, uuid=${config.uuid}, alpn=${config.alpn},
|
|
248
|
+
`${config.name} = tuic, ${config.server}, ${config.port}, sni=${config.sni}, uuid=${config.uuid}, alpn=${config.alpn}, token=${config.token}`,
|
|
236
249
|
...shared
|
|
237
250
|
]);
|
|
238
251
|
case 'socks5':
|
|
@@ -270,6 +283,16 @@ function encode$1(config) {
|
|
|
270
283
|
`skip-cert-verify=${config.skipCertVerify}`,
|
|
271
284
|
...shared
|
|
272
285
|
]);
|
|
286
|
+
case 'tuic-v5':
|
|
287
|
+
return joinString([
|
|
288
|
+
`${config.name} = tuic-v5, ${config.server}, ${config.port}`,
|
|
289
|
+
`password=${config.password}`,
|
|
290
|
+
`uuid=${config.uuid}`,
|
|
291
|
+
`alpn=${config.alpn}`,
|
|
292
|
+
`skip-cert-verify=${config.skipCertVerify}`,
|
|
293
|
+
`sni=${config.sni}`,
|
|
294
|
+
...shared
|
|
295
|
+
]);
|
|
273
296
|
default:
|
|
274
297
|
guard.never(config, 'type (clash encode)');
|
|
275
298
|
}
|
|
@@ -390,6 +413,7 @@ function encode(config) {
|
|
|
390
413
|
...shared
|
|
391
414
|
};
|
|
392
415
|
case 'tuic':
|
|
416
|
+
case 'tuic-v5':
|
|
393
417
|
return {
|
|
394
418
|
name: config.name,
|
|
395
419
|
type: 'tuic',
|
|
@@ -398,8 +422,12 @@ function encode(config) {
|
|
|
398
422
|
sni: config.sni,
|
|
399
423
|
uuid: config.uuid,
|
|
400
424
|
alpn: config.alpn.split(',').map((x)=>x.trim()),
|
|
401
|
-
|
|
402
|
-
|
|
425
|
+
...config.type === 'tuic' ? {
|
|
426
|
+
token: config.token
|
|
427
|
+
} : {
|
|
428
|
+
password: config.password
|
|
429
|
+
},
|
|
430
|
+
'skip-cert-verify': config.skipCertVerify,
|
|
403
431
|
udp: true,
|
|
404
432
|
...shared
|
|
405
433
|
};
|
package/dist/es/index.d.mts
CHANGED
|
@@ -52,13 +52,19 @@ interface TrojanBasicConfig extends SharedConfigBase, TlsSharedConfig {
|
|
|
52
52
|
/** udp-relay */
|
|
53
53
|
udp: boolean;
|
|
54
54
|
}
|
|
55
|
-
interface TuicConfig extends SharedConfigBase {
|
|
55
|
+
interface TuicConfig extends SharedConfigBase, TlsSharedConfig {
|
|
56
56
|
type: 'tuic';
|
|
57
57
|
sni: string;
|
|
58
58
|
uuid: string;
|
|
59
59
|
alpn: string;
|
|
60
|
+
token: string;
|
|
61
|
+
}
|
|
62
|
+
interface TuicV5Config extends SharedConfigBase, TlsSharedConfig {
|
|
63
|
+
type: 'tuic-v5';
|
|
64
|
+
sni: string;
|
|
65
|
+
uuid: string;
|
|
66
|
+
alpn: string;
|
|
60
67
|
password: string;
|
|
61
|
-
version: number;
|
|
62
68
|
}
|
|
63
69
|
interface Socks5Config extends SharedConfigBase {
|
|
64
70
|
type: 'socks5';
|
|
@@ -87,7 +93,7 @@ interface Hysteria2Config extends SharedConfigBase, Omit<TlsSharedConfig, 'sni'>
|
|
|
87
93
|
/** port hopping interval */
|
|
88
94
|
portHoppingInterval?: number;
|
|
89
95
|
}
|
|
90
|
-
type SupportedConfig = HttpProxyConfig | SnellConfig | TrojanConfig | ShadowSocksConfig | TuicConfig | Socks5Config | VmessConfig | Hysteria2Config;
|
|
96
|
+
type SupportedConfig = HttpProxyConfig | SnellConfig | TrojanConfig | ShadowSocksConfig | TuicConfig | TuicV5Config | Socks5Config | VmessConfig | Hysteria2Config;
|
|
91
97
|
|
|
92
98
|
declare function decode$1(raw: string): SupportedConfig;
|
|
93
99
|
declare function encode$1(config: SupportedConfig): string;
|
|
@@ -146,6 +152,9 @@ declare function encode(config: SupportedConfig): {
|
|
|
146
152
|
down?: undefined;
|
|
147
153
|
} | {
|
|
148
154
|
tfo: boolean | undefined;
|
|
155
|
+
'skip-cert-verify': boolean;
|
|
156
|
+
udp: boolean;
|
|
157
|
+
token: string;
|
|
149
158
|
name: string;
|
|
150
159
|
type: string;
|
|
151
160
|
server: string;
|
|
@@ -153,9 +162,6 @@ declare function encode(config: SupportedConfig): {
|
|
|
153
162
|
sni: string;
|
|
154
163
|
uuid: string;
|
|
155
164
|
alpn: string[];
|
|
156
|
-
token: string;
|
|
157
|
-
version: number;
|
|
158
|
-
udp: boolean;
|
|
159
165
|
alterId?: undefined;
|
|
160
166
|
tls?: undefined;
|
|
161
167
|
servername?: undefined;
|
|
@@ -167,7 +173,28 @@ declare function encode(config: SupportedConfig): {
|
|
|
167
173
|
ports?: undefined;
|
|
168
174
|
password?: undefined;
|
|
169
175
|
down?: undefined;
|
|
170
|
-
|
|
176
|
+
} | {
|
|
177
|
+
tfo: boolean | undefined;
|
|
178
|
+
'skip-cert-verify': boolean;
|
|
179
|
+
udp: boolean;
|
|
180
|
+
password: string;
|
|
181
|
+
name: string;
|
|
182
|
+
type: string;
|
|
183
|
+
server: string;
|
|
184
|
+
port: number;
|
|
185
|
+
sni: string;
|
|
186
|
+
uuid: string;
|
|
187
|
+
alpn: string[];
|
|
188
|
+
alterId?: undefined;
|
|
189
|
+
tls?: undefined;
|
|
190
|
+
servername?: undefined;
|
|
191
|
+
'ws-path'?: undefined;
|
|
192
|
+
'ws-headers'?: undefined;
|
|
193
|
+
cipher?: undefined;
|
|
194
|
+
'ws-opts'?: undefined;
|
|
195
|
+
network?: undefined;
|
|
196
|
+
ports?: undefined;
|
|
197
|
+
down?: undefined;
|
|
171
198
|
} | {
|
|
172
199
|
tfo: boolean | undefined;
|
|
173
200
|
name: string;
|
|
@@ -277,4 +304,4 @@ declare namespace index {
|
|
|
277
304
|
export { index_parse as parse };
|
|
278
305
|
}
|
|
279
306
|
|
|
280
|
-
export { type HttpProxyConfig, type Hysteria2Config, type ShadowSocksConfig, type SharedConfigBase, type SnellConfig, type Socks5Config, type SupportedConfig, type TrojanBasicConfig, type TrojanConfig, type TuicConfig, type VmessConfig, index$2 as clash, index$1 as ss, index$3 as surge, index as trojan };
|
|
307
|
+
export { type HttpProxyConfig, type Hysteria2Config, type ShadowSocksConfig, type SharedConfigBase, type SnellConfig, type Socks5Config, type SupportedConfig, type TrojanBasicConfig, type TrojanConfig, type TuicConfig, type TuicV5Config, type VmessConfig, index$2 as clash, index$1 as ss, index$3 as surge, index as trojan };
|
package/dist/es/index.mjs
CHANGED
|
@@ -46,7 +46,8 @@ const strKeys = new Set([
|
|
|
46
46
|
'block-quic',
|
|
47
47
|
'ws-path',
|
|
48
48
|
'ws-headers',
|
|
49
|
-
'port-hopping'
|
|
49
|
+
'port-hopping',
|
|
50
|
+
'token'
|
|
50
51
|
]);
|
|
51
52
|
const isProxyStrKey = (key)=>strKeys.has(key);
|
|
52
53
|
const UNSUPPORTED_VALUE = Symbol('unsupported');
|
|
@@ -143,8 +144,20 @@ function decode$1(raw) {
|
|
|
143
144
|
sni: restDetails.sni,
|
|
144
145
|
uuid: restDetails.uuid,
|
|
145
146
|
alpn: restDetails.alpn,
|
|
147
|
+
token: restDetails.token,
|
|
148
|
+
skipCertVerify: restDetails['skip-cert-verify'],
|
|
149
|
+
...shared
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
case 'tuic-v5':
|
|
153
|
+
{
|
|
154
|
+
return {
|
|
155
|
+
type: 'tuic-v5',
|
|
156
|
+
uuid: restDetails.uuid,
|
|
157
|
+
alpn: restDetails.alpn,
|
|
146
158
|
password: restDetails.password,
|
|
147
|
-
|
|
159
|
+
sni: restDetails.sni,
|
|
160
|
+
skipCertVerify: restDetails['skip-cert-verify'],
|
|
148
161
|
...shared
|
|
149
162
|
};
|
|
150
163
|
}
|
|
@@ -232,7 +245,7 @@ function encode$1(config) {
|
|
|
232
245
|
]);
|
|
233
246
|
case 'tuic':
|
|
234
247
|
return joinString([
|
|
235
|
-
`${config.name} = tuic, ${config.server}, ${config.port}, sni=${config.sni}, uuid=${config.uuid}, alpn=${config.alpn},
|
|
248
|
+
`${config.name} = tuic, ${config.server}, ${config.port}, sni=${config.sni}, uuid=${config.uuid}, alpn=${config.alpn}, token=${config.token}`,
|
|
236
249
|
...shared
|
|
237
250
|
]);
|
|
238
251
|
case 'socks5':
|
|
@@ -270,6 +283,16 @@ function encode$1(config) {
|
|
|
270
283
|
`skip-cert-verify=${config.skipCertVerify}`,
|
|
271
284
|
...shared
|
|
272
285
|
]);
|
|
286
|
+
case 'tuic-v5':
|
|
287
|
+
return joinString([
|
|
288
|
+
`${config.name} = tuic-v5, ${config.server}, ${config.port}`,
|
|
289
|
+
`password=${config.password}`,
|
|
290
|
+
`uuid=${config.uuid}`,
|
|
291
|
+
`alpn=${config.alpn}`,
|
|
292
|
+
`skip-cert-verify=${config.skipCertVerify}`,
|
|
293
|
+
`sni=${config.sni}`,
|
|
294
|
+
...shared
|
|
295
|
+
]);
|
|
273
296
|
default:
|
|
274
297
|
never(config, 'type (clash encode)');
|
|
275
298
|
}
|
|
@@ -390,6 +413,7 @@ function encode(config) {
|
|
|
390
413
|
...shared
|
|
391
414
|
};
|
|
392
415
|
case 'tuic':
|
|
416
|
+
case 'tuic-v5':
|
|
393
417
|
return {
|
|
394
418
|
name: config.name,
|
|
395
419
|
type: 'tuic',
|
|
@@ -398,8 +422,12 @@ function encode(config) {
|
|
|
398
422
|
sni: config.sni,
|
|
399
423
|
uuid: config.uuid,
|
|
400
424
|
alpn: config.alpn.split(',').map((x)=>x.trim()),
|
|
401
|
-
|
|
402
|
-
|
|
425
|
+
...config.type === 'tuic' ? {
|
|
426
|
+
token: config.token
|
|
427
|
+
} : {
|
|
428
|
+
password: config.password
|
|
429
|
+
},
|
|
430
|
+
'skip-cert-verify': config.skipCertVerify,
|
|
403
431
|
udp: true,
|
|
404
432
|
...shared
|
|
405
433
|
};
|