sing-box-kit 0.1.1 → 0.1.3

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/index.d.mts CHANGED
@@ -1,4 +1,2451 @@
1
1
  import "ajv";
2
+ type ReadonlyJson<T> = T extends object ? { readonly [K in keyof T]: ReadonlyJson<T[K]>; } : T;
3
+ type UnionKeys<T> = T extends unknown ? keyof T : never;
4
+ type StrictUnion<T, All = T> = T extends unknown ? T & { readonly [K in Exclude<UnionKeys<All>, keyof T>]?: never; } : never;
5
+ type CamelCase<S extends string> = S extends `${infer Head}-${infer Tail}` ? `${Head}${Capitalize<CamelCase<Tail>>}` : S;
6
+ type Target = "inbounds" | "outbounds" | "endpoints" | "services" | "http_clients" | "dns.servers" | "route.rule_set" | "certificate_providers" | "network_namespaces";
7
+ type Role = "inbound" | "listen-detour" | "dial-detour" | "egress" | "preferred-routes" | "dns-server" | "preferred-domain" | "ssm" | "certificate-provider" | "http-client" | "netns" | "rule-set" | "tailscale-endpoint" | "openconnect-endpoint" | "openvpn-client-endpoint" | "resolved-service";
8
+ declare const resourceBrand: unique symbol;
9
+ interface Resource<T extends Target = Target, K extends string = string, Tag extends string | readonly string[] | undefined = string | readonly string[] | undefined, R extends Role = Role> {
10
+ readonly [resourceBrand]: {
11
+ target: T;
12
+ kind: K;
13
+ tag: Tag;
14
+ roles: R;
15
+ };
16
+ }
17
+ type InboundRef = Resource<"inbounds" | "endpoints", string, string>;
18
+ type ListenDetour = Resource<"inbounds", string, string, "listen-detour" | "inbound" | "ssm">;
19
+ type Egress = Resource<"outbounds" | "endpoints", string, string>;
20
+ declare const preferredRouteEndpoints: readonly ["tailscale", "wireguard", "openconnect", "openvpn-client"];
21
+ type PreferredRoutes = Resource<"endpoints", (typeof preferredRouteEndpoints)[number], string> | Resource<"outbounds", "bridge", string>;
22
+ type DnsServer = Resource<"dns.servers", string, string>;
23
+ declare const preferredDnsKinds: readonly ["hosts", "local", "mdns", "tailscale", "openconnect", "openvpn", "resolved"];
24
+ type PreferredDomain = Resource<"dns.servers", (typeof preferredDnsKinds)[number], string>;
25
+ type Namespace = Resource<"network_namespaces", string, string>;
26
+ type CertificateProvider$1 = Resource<"certificate_providers", string, string>;
27
+ type TaggedHttpClient = Resource<"http_clients", "http-client", string>;
28
+ type HttpClientValue = Resource<"http_clients", "http-client", string | undefined>;
29
+ type RuleSetRef = Resource<"route.rule_set", string, string | readonly [string]>;
30
+ type SsmInbound = Resource<"inbounds", "shadowsocks", string, "inbound" | "listen-detour" | "ssm"> & {
31
+ readonly [ssmBrand]: true;
32
+ };
33
+ declare const ssmBrand: unique symbol;
34
+ type TailscaleEndpoint = Resource<"endpoints", "tailscale", string>;
35
+ type OpenConnectEndpoint = Resource<"endpoints", "openconnect", string>;
36
+ type OpenVpnClientEndpoint = Resource<"endpoints", "openvpn-client", string>;
37
+ type ResolvedService = Resource<"services", "resolved", string>;
38
+ type Duration$1 = string;
39
+ type UDPTimeout$1 = number | string;
40
+ type CertificateProviderReference$1 = CertificateProvider$1 | ({
41
+ type: "acme";
42
+ domain?: string | string[];
43
+ data_directory?: string;
44
+ default_server_name?: string;
45
+ email?: string;
46
+ provider?: string;
47
+ account_key?: string;
48
+ disable_http_challenge?: boolean;
49
+ disable_tls_alpn_challenge?: boolean;
50
+ alternative_http_port?: number;
51
+ alternative_tls_port?: number;
52
+ external_account?: ACMEExternalAccountOptions$1;
53
+ dns01_challenge?: ACMEProviderDNS01Challenge$1;
54
+ key_type?: "ed25519" | "p256" | "p384" | "rsa2048" | "rsa4096";
55
+ profile?: string;
56
+ http_client?: HTTPClientReference$1;
57
+ } | {
58
+ type: "cloudflare-origin-ca";
59
+ domain?: string | string[];
60
+ data_directory?: string;
61
+ api_token?: string;
62
+ origin_ca_key?: string;
63
+ request_type?: "origin-rsa" | "origin-ecc";
64
+ requested_validity?: 0 | 7 | 30 | 90 | 365 | 730 | 1095 | 5475;
65
+ http_client?: HTTPClientReference$1;
66
+ } | {
67
+ type: "tailscale";
68
+ endpoint?: TailscaleEndpoint;
69
+ });
70
+ type ACMEProviderDNS01Challenge$1 = {
71
+ provider: "alidns";
72
+ ttl?: Duration$1;
73
+ propagation_delay?: Duration$1;
74
+ propagation_timeout?: Duration$1;
75
+ resolvers?: string | string[];
76
+ override_domain?: string;
77
+ access_key_id?: string;
78
+ access_key_secret?: string;
79
+ region_id?: string;
80
+ security_token?: string;
81
+ } | {
82
+ provider: "cloudflare";
83
+ ttl?: Duration$1;
84
+ propagation_delay?: Duration$1;
85
+ propagation_timeout?: Duration$1;
86
+ resolvers?: string | string[];
87
+ override_domain?: string;
88
+ api_token?: string;
89
+ zone_token?: string;
90
+ } | {
91
+ provider: "acmedns";
92
+ ttl?: Duration$1;
93
+ propagation_delay?: Duration$1;
94
+ propagation_timeout?: Duration$1;
95
+ resolvers?: string | string[];
96
+ override_domain?: string;
97
+ username?: string;
98
+ password?: string;
99
+ subdomain?: string;
100
+ server_url?: string;
101
+ };
102
+ type HTTPClientReference$1 = HttpClientValue | {
103
+ engine?: "go" | "apple";
104
+ version?: 0 | 1 | 2 | 3;
105
+ disable_version_fallback?: boolean;
106
+ headers?: HTTPHeader$1;
107
+ tls?: OutboundTLSOptions$1;
108
+ detour?: Egress;
109
+ bind_interface?: string;
110
+ inet4_bind_address?: string;
111
+ inet6_bind_address?: string;
112
+ bind_address_no_port?: boolean;
113
+ protect_path?: string;
114
+ routing_mark?: number | string;
115
+ reuse_addr?: boolean;
116
+ netns?: Namespace | string;
117
+ connect_timeout?: Duration$1;
118
+ tcp_fast_open?: boolean;
119
+ tcp_multi_path?: boolean;
120
+ disable_tcp_keep_alive?: boolean;
121
+ tcp_keep_alive?: Duration$1;
122
+ tcp_keep_alive_interval?: Duration$1;
123
+ udp_fragment?: boolean;
124
+ domain_resolver?: DomainResolver$2;
125
+ network_strategy?: "default" | "fallback" | "hybrid";
126
+ network_type?: InterfaceType$1 | InterfaceType$1[];
127
+ fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
128
+ fallback_delay?: Duration$1;
129
+ idle_timeout?: Duration$1;
130
+ keep_alive_period?: Duration$1;
131
+ stream_receive_window?: number | string;
132
+ connection_receive_window?: number | string;
133
+ max_concurrent_streams?: number;
134
+ initial_packet_size?: number;
135
+ disable_path_mtu_discovery?: boolean;
136
+ };
137
+ type DomainResolver$2 = DnsServer | {
138
+ server: DnsServer;
139
+ timeout?: Duration$1;
140
+ strategy?: DomainStrategy$1;
141
+ disable_cache?: boolean;
142
+ disable_optimistic_cache?: boolean;
143
+ rewrite_ttl?: number;
144
+ client_subnet?: string;
145
+ };
146
+ type DomainStrategy$1 = "" | "as_is" | "prefer_ipv4" | "prefer_ipv6" | "ipv4_only" | "ipv6_only";
147
+ type InterfaceType$1 = "cellular" | "ethernet" | "other" | "wifi";
148
+ type InboundSnellOptions = {
149
+ tag: string;
150
+ version: 5;
151
+ psk?: string;
152
+ users?: SnellUser$1[];
153
+ obfs_mode?: "none" | "http" | "tls";
154
+ } | {
155
+ tag: string;
156
+ version: 6;
157
+ psk?: string;
158
+ users?: SnellUser$1[];
159
+ mode?: "default" | "unshaped" | "unsafe-raw";
160
+ };
161
+ type V2RayTransport$1 = {
162
+ type: "http";
163
+ host?: string | string[];
164
+ path?: string;
165
+ method?: string;
166
+ headers?: HTTPHeader$1;
167
+ idle_timeout?: Duration$1;
168
+ ping_timeout?: Duration$1;
169
+ } | {
170
+ type: "ws";
171
+ path?: string;
172
+ headers?: HTTPHeader$1;
173
+ max_early_data?: number;
174
+ early_data_header_name?: string;
175
+ } | {
176
+ type: "quic";
177
+ } | {
178
+ type: "grpc";
179
+ service_name?: string;
180
+ idle_timeout?: Duration$1;
181
+ ping_timeout?: Duration$1;
182
+ permit_without_stream?: boolean;
183
+ } | {
184
+ type: "httpupgrade";
185
+ host?: string;
186
+ path?: string;
187
+ headers?: HTTPHeader$1;
188
+ };
189
+ type OutboundSnellOptions = {
190
+ tag: string;
191
+ version: 4;
192
+ server?: string;
193
+ server_port?: number;
194
+ psk?: string;
195
+ userkey?: string;
196
+ reuse?: boolean;
197
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
198
+ obfs_mode?: "none" | "http" | "tls";
199
+ obfs_host?: string;
200
+ } | {
201
+ tag: string;
202
+ version: 6;
203
+ server?: string;
204
+ server_port?: number;
205
+ psk?: string;
206
+ userkey?: string;
207
+ reuse?: boolean;
208
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
209
+ mode?: "default" | "unshaped" | "unsafe-raw";
210
+ };
211
+ type ServiceUsbipServerOptions = {
212
+ tag?: string;
213
+ provider?: "default" | "";
214
+ devices?: USBIPDeviceMatch$1[];
215
+ } | {
216
+ tag?: string;
217
+ provider: "dynamic";
218
+ };
219
+ type HeadlessRule$1 = {
220
+ type?: "default" | "";
221
+ query_type?: DNSQueryType$1 | DNSQueryType$1[];
222
+ network?: ("tcp" | "udp" | "icmp") | ("tcp" | "udp" | "icmp")[];
223
+ domain?: string | string[];
224
+ domain_suffix?: string | string[];
225
+ domain_keyword?: string | string[];
226
+ domain_regex?: string | string[];
227
+ source_ip_cidr?: string | string[];
228
+ ip_cidr?: string | string[];
229
+ source_port?: number | number[];
230
+ source_port_range?: string | string[];
231
+ port?: number | number[];
232
+ port_range?: string | string[];
233
+ process_name?: string | string[];
234
+ process_path?: string | string[];
235
+ process_path_regex?: string | string[];
236
+ package_name?: string | string[];
237
+ package_name_regex?: string | string[];
238
+ network_type?: InterfaceType$1 | InterfaceType$1[];
239
+ network_is_expensive?: boolean;
240
+ network_is_constrained?: boolean;
241
+ wifi_ssid?: string | string[];
242
+ wifi_bssid?: string | string[];
243
+ network_interface_address?: {
244
+ cellular?: string | string[];
245
+ ethernet?: string | string[];
246
+ other?: string | string[];
247
+ wifi?: string | string[];
248
+ };
249
+ default_interface_address?: string | string[];
250
+ invert?: boolean;
251
+ } | {
252
+ type: "logical";
253
+ mode: "and" | "or";
254
+ rules: HeadlessRule$1[];
255
+ invert?: boolean;
256
+ };
257
+ type DNSQueryType$1 = number | ("A" | "AAAA" | "AFSDB" | "AMTRELAY" | "ANY" | "APL" | "ATMA" | "AVC" | "AXFR" | "CAA" | "CDNSKEY" | "CDS" | "CERT" | "CNAME" | "CSYNC" | "DHCID" | "DLV" | "DNAME" | "DNSKEY" | "DS" | "EID" | "EUI48" | "EUI64" | "GID" | "GPOS" | "HINFO" | "HIP" | "HTTPS" | "IPSECKEY" | "ISDN" | "IXFR" | "KEY" | "KX" | "L32" | "L64" | "LOC" | "LP" | "MAILA" | "MAILB" | "MB" | "MD" | "MF" | "MG" | "MINFO" | "MR" | "MX" | "NAPTR" | "NID" | "NIMLOC" | "NINFO" | "NS" | "NSAP-PTR" | "NSEC" | "NSEC3" | "NSEC3PARAM" | "NULL" | "NXNAME" | "NXT" | "None" | "OPENPGPKEY" | "OPT" | "PTR" | "PX" | "RESINFO" | "RKEY" | "RP" | "RRSIG" | "RT" | "Reserved" | "SIG" | "SMIMEA" | "SOA" | "SPF" | "SRV" | "SSHFP" | "SVCB" | "TA" | "TALINK" | "TKEY" | "TLSA" | "TSIG" | "TXT" | "UID" | "UINFO" | "UNSPEC" | "URI" | "X25" | "ZONEMD");
258
+ type DNSRCode$1 = number | ("NOERROR" | "FORMERR" | "SERVFAIL" | "NXDOMAIN" | "NOTIMP" | "NOTIMPL" | "REFUSED" | "YXDOMAIN" | "YXRRSET" | "NXRRSET" | "NOTAUTH" | "NOTZONE" | "DSOTYPENI" | "BADSIG" | "BADKEY" | "BADTIME" | "BADMODE" | "BADNAME" | "BADALG" | "BADTRUNC" | "BADCOOKIE");
259
+ type RouteActionInput = {
260
+ action: "route";
261
+ outbound: Egress;
262
+ override_address?: string;
263
+ override_port?: number;
264
+ network_strategy?: "default" | "fallback" | "hybrid";
265
+ fallback_delay?: number;
266
+ udp_disable_domain_unmapping?: boolean;
267
+ udp_connect?: boolean;
268
+ udp_timeout?: Duration$1;
269
+ tls_fragment?: boolean;
270
+ tls_fragment_fallback_delay?: Duration$1;
271
+ tls_record_fragment?: boolean;
272
+ tls_spoof?: string;
273
+ tls_spoof_method?: "wrong-sequence" | "wrong-checksum" | "wrong-ack" | "wrong-md5" | "wrong-timestamp";
274
+ } | {
275
+ action: "route-options";
276
+ override_address?: string;
277
+ override_port?: number;
278
+ network_strategy?: "default" | "fallback" | "hybrid";
279
+ fallback_delay?: number;
280
+ udp_disable_domain_unmapping?: boolean;
281
+ udp_connect?: boolean;
282
+ udp_timeout?: Duration$1;
283
+ tls_fragment?: boolean;
284
+ tls_fragment_fallback_delay?: Duration$1;
285
+ tls_record_fragment?: boolean;
286
+ tls_spoof?: string;
287
+ tls_spoof_method?: "wrong-sequence" | "wrong-checksum" | "wrong-ack" | "wrong-md5" | "wrong-timestamp";
288
+ } | {
289
+ action: "bypass";
290
+ outbound?: Egress;
291
+ override_address?: string;
292
+ override_port?: number;
293
+ network_strategy?: "default" | "fallback" | "hybrid";
294
+ fallback_delay?: number;
295
+ udp_disable_domain_unmapping?: boolean;
296
+ udp_connect?: boolean;
297
+ udp_timeout?: Duration$1;
298
+ tls_fragment?: boolean;
299
+ tls_fragment_fallback_delay?: Duration$1;
300
+ tls_record_fragment?: boolean;
301
+ tls_spoof?: string;
302
+ tls_spoof_method?: "wrong-sequence" | "wrong-checksum" | "wrong-ack" | "wrong-md5" | "wrong-timestamp";
303
+ } | {
304
+ action: "reject";
305
+ method?: "" | "default" | "drop" | "reply";
306
+ no_drop?: boolean;
307
+ } | {
308
+ action: "hijack-dns";
309
+ } | {
310
+ action: "sniff";
311
+ sniffer?: ("tls" | "http" | "quic" | "dns" | "stun" | "bittorrent" | "dtls" | "ssh" | "rdp" | "ntp") | ("tls" | "http" | "quic" | "dns" | "stun" | "bittorrent" | "dtls" | "ssh" | "rdp" | "ntp")[];
312
+ timeout?: Duration$1;
313
+ } | {
314
+ action: "resolve";
315
+ server?: DnsServer;
316
+ timeout?: Duration$1;
317
+ strategy?: DomainStrategy$1;
318
+ disable_cache?: boolean;
319
+ disable_optimistic_cache?: boolean;
320
+ rewrite_ttl?: number;
321
+ client_subnet?: string;
322
+ };
323
+ type DnsActionInput = {
324
+ action: "route";
325
+ race?: boolean;
326
+ server: DnsServer;
327
+ speculative?: boolean;
328
+ timeout?: Duration$1;
329
+ disable_cache?: boolean;
330
+ disable_optimistic_cache?: boolean;
331
+ rewrite_ttl?: number;
332
+ client_subnet?: string;
333
+ remove_client_subnet?: boolean;
334
+ } | {
335
+ action: "evaluate";
336
+ race?: boolean;
337
+ server: DnsServer;
338
+ tag?: string;
339
+ speculative?: boolean;
340
+ timeout?: Duration$1;
341
+ disable_cache?: boolean;
342
+ disable_optimistic_cache?: boolean;
343
+ rewrite_ttl?: number;
344
+ client_subnet?: string;
345
+ remove_client_subnet?: boolean;
346
+ } | {
347
+ action: "respond";
348
+ race?: boolean;
349
+ } | {
350
+ action: "route-options";
351
+ race?: boolean;
352
+ timeout?: Duration$1;
353
+ disable_cache?: boolean;
354
+ disable_optimistic_cache?: boolean;
355
+ rewrite_ttl?: number;
356
+ client_subnet?: string;
357
+ remove_client_subnet?: boolean;
358
+ } | {
359
+ action: "reject";
360
+ race?: boolean;
361
+ method?: "default" | "drop";
362
+ no_drop?: boolean;
363
+ } | {
364
+ action: "predefined";
365
+ race?: boolean;
366
+ rcode?: DNSRCode$1;
367
+ answer?: string | string[];
368
+ ns?: string | string[];
369
+ extra?: string | string[];
370
+ };
371
+ interface SBKitInputs {
372
+ factories: {
373
+ inbounds: {
374
+ anytls: {
375
+ options: InboundAnytlsOptions;
376
+ listen: InboundAnytlsListen;
377
+ tls: InboundTLSOptions$1;
378
+ };
379
+ cloudflared: {
380
+ options: InboundCloudflaredOptions;
381
+ };
382
+ direct: {
383
+ options: InboundDirectOptions;
384
+ listen: InboundAnytlsListen;
385
+ };
386
+ http: {
387
+ options: InboundHttpOptions;
388
+ listen: InboundHttpListen;
389
+ tls: InboundTLSOptions$1;
390
+ };
391
+ hysteria: {
392
+ options: InboundHysteriaOptions;
393
+ listen: InboundAnytlsListen;
394
+ tls: InboundTLSOptions$1;
395
+ };
396
+ hysteria2: {
397
+ options: InboundHysteria2Options;
398
+ listen: InboundAnytlsListen;
399
+ tls: InboundTLSOptions$1;
400
+ };
401
+ mixed: {
402
+ options: InboundHttpOptions;
403
+ listen: InboundHttpListen;
404
+ tls: InboundTLSOptions$1;
405
+ };
406
+ naive: {
407
+ options: InboundNaiveOptions;
408
+ listen: InboundAnytlsListen;
409
+ tls: InboundTLSOptions$1;
410
+ };
411
+ redirect: {
412
+ options: InboundRedirectOptions;
413
+ listen: InboundAnytlsListen;
414
+ };
415
+ shadowsocks: {
416
+ options: InboundShadowsocksOptions;
417
+ listen: InboundAnytlsListen;
418
+ };
419
+ shadowtls: {
420
+ options: InboundShadowtlsOptions;
421
+ listen: InboundAnytlsListen;
422
+ };
423
+ snell: {
424
+ options: InboundSnellOptions;
425
+ listen: InboundAnytlsListen;
426
+ };
427
+ socks: {
428
+ options: InboundSocksOptions;
429
+ listen: InboundHttpListen;
430
+ };
431
+ tproxy: {
432
+ options: InboundTproxyOptions;
433
+ listen: InboundAnytlsListen;
434
+ };
435
+ trojan: {
436
+ options: InboundTrojanOptions;
437
+ listen: InboundAnytlsListen;
438
+ tls: InboundTLSOptions$1;
439
+ };
440
+ tuic: {
441
+ options: InboundTuicOptions;
442
+ listen: InboundAnytlsListen;
443
+ tls: InboundTLSOptions$1;
444
+ };
445
+ tun: {
446
+ options: InboundTunOptions;
447
+ listen: InboundTunListen;
448
+ };
449
+ vless: {
450
+ options: InboundVlessOptions;
451
+ listen: InboundAnytlsListen;
452
+ tls: InboundTLSOptions$1;
453
+ };
454
+ vmess: {
455
+ options: InboundVmessOptions;
456
+ listen: InboundAnytlsListen;
457
+ tls: InboundTLSOptions$1;
458
+ };
459
+ };
460
+ outbounds: {
461
+ anytls: {
462
+ options: OutboundAnytlsOptions;
463
+ dial: OutboundAnytlsDial;
464
+ tls: OutboundTLSOptions$1;
465
+ };
466
+ block: {
467
+ options: InboundRedirectOptions;
468
+ };
469
+ bridge: {
470
+ options: OutboundBridgeOptions;
471
+ };
472
+ direct: {
473
+ options: InboundRedirectOptions;
474
+ dial: OutboundDirectDial;
475
+ };
476
+ http: {
477
+ options: OutboundHttpOptions;
478
+ dial: OutboundAnytlsDial;
479
+ tls: OutboundTLSOptions$1;
480
+ };
481
+ hysteria: {
482
+ options: OutboundHysteriaOptions;
483
+ dial: OutboundAnytlsDial;
484
+ tls: OutboundTLSOptions$1;
485
+ };
486
+ hysteria2: {
487
+ options: OutboundHysteria2Options;
488
+ dial: OutboundAnytlsDial;
489
+ tls: OutboundTLSOptions$1;
490
+ };
491
+ naive: {
492
+ options: OutboundNaiveOptions;
493
+ dial: OutboundAnytlsDial;
494
+ tls: OutboundTLSOptions$1;
495
+ };
496
+ selector: {
497
+ options: OutboundSelectorOptions;
498
+ };
499
+ shadowsocks: {
500
+ options: OutboundShadowsocksOptions;
501
+ dial: OutboundAnytlsDial;
502
+ };
503
+ shadowtls: {
504
+ options: OutboundShadowtlsOptions;
505
+ dial: OutboundAnytlsDial;
506
+ tls: OutboundTLSOptions$1;
507
+ };
508
+ snell: {
509
+ options: OutboundSnellOptions;
510
+ dial: OutboundAnytlsDial;
511
+ };
512
+ socks: {
513
+ options: OutboundSocksOptions;
514
+ dial: OutboundAnytlsDial;
515
+ };
516
+ ssh: {
517
+ options: OutboundSshOptions;
518
+ dial: OutboundAnytlsDial;
519
+ };
520
+ tor: {
521
+ options: OutboundTorOptions;
522
+ dial: OutboundAnytlsDial;
523
+ };
524
+ trojan: {
525
+ options: OutboundTrojanOptions;
526
+ dial: OutboundAnytlsDial;
527
+ tls: OutboundTLSOptions$1;
528
+ };
529
+ tuic: {
530
+ options: OutboundTuicOptions;
531
+ dial: OutboundAnytlsDial;
532
+ tls: OutboundTLSOptions$1;
533
+ };
534
+ urltest: {
535
+ options: OutboundUrltestOptions;
536
+ };
537
+ vless: {
538
+ options: OutboundVlessOptions;
539
+ dial: OutboundAnytlsDial;
540
+ tls: OutboundTLSOptions$1;
541
+ };
542
+ vmess: {
543
+ options: OutboundVmessOptions;
544
+ dial: OutboundAnytlsDial;
545
+ tls: OutboundTLSOptions$1;
546
+ };
547
+ };
548
+ endpoints: {
549
+ openconnect: {
550
+ options: EndpointOpenconnectOptions;
551
+ dial: OutboundAnytlsDial;
552
+ tls: OpenConnectTLSOptions$1;
553
+ };
554
+ "openvpn-client": {
555
+ options: EndpointOpenvpnClientOptions;
556
+ dial: OutboundAnytlsDial;
557
+ tls: OpenVPNOutboundTLSOptions$1;
558
+ };
559
+ "openvpn-server": {
560
+ options: EndpointOpenvpnServerOptions;
561
+ listen: InboundAnytlsListen;
562
+ tls: OpenVPNInboundTLSOptions$1;
563
+ };
564
+ tailscale: {
565
+ options: EndpointTailscaleOptions;
566
+ dial: OutboundAnytlsDial;
567
+ };
568
+ wireguard: {
569
+ options: EndpointWireguardOptions;
570
+ dial: OutboundAnytlsDial;
571
+ };
572
+ };
573
+ services: {
574
+ api: {
575
+ options: ServiceApiOptions;
576
+ listen: InboundAnytlsListen;
577
+ tls: InboundTLSOptions$1;
578
+ };
579
+ ccm: {
580
+ options: ServiceCcmOptions;
581
+ listen: ServiceCcmListen;
582
+ tls: InboundTLSOptions$1;
583
+ };
584
+ derp: {
585
+ options: ServiceDerpOptions;
586
+ listen: InboundAnytlsListen;
587
+ tls: InboundTLSOptions$1;
588
+ };
589
+ "hysteria-realm": {
590
+ options: ServiceHysteriaRealmOptions;
591
+ listen: InboundAnytlsListen;
592
+ tls: InboundTLSOptions$1;
593
+ };
594
+ ocm: {
595
+ options: ServiceOcmOptions;
596
+ listen: ServiceCcmListen;
597
+ tls: InboundTLSOptions$1;
598
+ };
599
+ "oom-killer": {
600
+ options: ServiceOomKillerOptions;
601
+ };
602
+ resolved: {
603
+ options: ServiceResolvedOptions;
604
+ listen: InboundAnytlsListen;
605
+ };
606
+ "ssm-api": {
607
+ options: ServiceSsmApiOptions;
608
+ listen: InboundAnytlsListen;
609
+ tls: InboundTLSOptions$1;
610
+ };
611
+ "usbip-client": {
612
+ options: ServiceUsbipClientOptions;
613
+ dial: OutboundAnytlsDial;
614
+ };
615
+ "usbip-server": {
616
+ options: ServiceUsbipServerOptions;
617
+ listen: InboundAnytlsListen;
618
+ };
619
+ };
620
+ http_clients: {
621
+ "http-client": {
622
+ options: HTTPClientHttpClientOptions;
623
+ dial: OutboundAnytlsDial;
624
+ tls: OutboundTLSOptions$1;
625
+ };
626
+ };
627
+ "dns.servers": {
628
+ dhcp: {
629
+ options: DNSServerDhcpOptions;
630
+ dial: OutboundAnytlsDial;
631
+ };
632
+ fakeip: {
633
+ options: DNSServerFakeipOptions;
634
+ };
635
+ h3: {
636
+ options: DNSServerH3Options;
637
+ dial: OutboundAnytlsDial;
638
+ tls: OutboundTLSOptions$1;
639
+ };
640
+ hosts: {
641
+ options: DNSServerHostsOptions;
642
+ };
643
+ https: {
644
+ options: DNSServerHttpsOptions;
645
+ dial: OutboundAnytlsDial;
646
+ tls: OutboundTLSOptions$1;
647
+ };
648
+ local: {
649
+ options: DNSServerLocalOptions;
650
+ dial: OutboundAnytlsDial;
651
+ };
652
+ mdns: {
653
+ options: DNSServerMdnsOptions;
654
+ dial: OutboundAnytlsDial;
655
+ };
656
+ openconnect: {
657
+ options: DNSServerOpenconnectOptions;
658
+ };
659
+ openvpn: {
660
+ options: DNSServerOpenvpnOptions;
661
+ };
662
+ quic: {
663
+ options: DNSServerQuicOptions;
664
+ dial: OutboundAnytlsDial;
665
+ tls: OutboundTLSOptions$1;
666
+ };
667
+ resolved: {
668
+ options: DNSServerResolvedOptions;
669
+ };
670
+ tailscale: {
671
+ options: DNSServerTailscaleOptions;
672
+ };
673
+ tcp: {
674
+ options: DNSServerTcpOptions;
675
+ dial: OutboundAnytlsDial;
676
+ };
677
+ tls: {
678
+ options: DNSServerTcpOptions;
679
+ dial: OutboundAnytlsDial;
680
+ tls: OutboundTLSOptions$1;
681
+ };
682
+ udp: {
683
+ options: DNSServerTcpOptions;
684
+ dial: OutboundAnytlsDial;
685
+ };
686
+ };
687
+ "route.rule_set": {
688
+ inline: {
689
+ options: RuleSetInlineOptions;
690
+ };
691
+ local: {
692
+ options: RuleSetLocalOptions;
693
+ };
694
+ remote: {
695
+ options: RuleSetRemoteOptions;
696
+ };
697
+ };
698
+ certificate_providers: {
699
+ acme: {
700
+ options: CertificateProviderAcmeOptions;
701
+ };
702
+ "cloudflare-origin-ca": {
703
+ options: CertificateProviderCloudflareOriginCaOptions;
704
+ };
705
+ tailscale: {
706
+ options: CertificateProviderTailscaleOptions;
707
+ };
708
+ };
709
+ network_namespaces: {
710
+ default: {
711
+ options: NetworkNamespaceDefaultOptions;
712
+ };
713
+ unshare: {
714
+ options: NetworkNamespaceUnshareOptions;
715
+ };
716
+ };
717
+ };
718
+ root: {
719
+ $schema: string;
720
+ log: LogOptions$1;
721
+ ntp: NTPOptions$1;
722
+ certificate: {
723
+ store?: "system" | "mozilla" | "chrome" | "none";
724
+ certificate?: string | string[];
725
+ certificate_path?: string | string[];
726
+ certificate_directory_path?: string | string[];
727
+ };
728
+ experimental: ExperimentalOptions$1;
729
+ };
730
+ sections: {
731
+ route: RouteSettings;
732
+ dns: DnsSettings;
733
+ };
734
+ matches: {
735
+ route: RouteMatchFields;
736
+ dns: DnsMatchFields;
737
+ };
738
+ actions: {
739
+ route: RouteActionInput;
740
+ dns: DnsActionInput;
741
+ };
742
+ }
743
+ interface InboundAnytlsOptions {
744
+ tag: string;
745
+ users?: AnyTLSUser$1[];
746
+ padding_scheme?: string | string[];
747
+ }
748
+ interface AnyTLSUser$1 {
749
+ name?: string;
750
+ password?: string;
751
+ }
752
+ interface InboundAnytlsListen {
753
+ port?: number;
754
+ bind_interface?: string;
755
+ routing_mark?: number | string;
756
+ reuse_addr?: boolean;
757
+ netns?: Namespace | string;
758
+ disable_tcp_keep_alive?: boolean;
759
+ tcp_keep_alive?: Duration$1;
760
+ tcp_keep_alive_interval?: Duration$1;
761
+ tcp_fast_open?: boolean;
762
+ tcp_multi_path?: boolean;
763
+ udp_fragment?: boolean;
764
+ udp_timeout?: UDPTimeout$1;
765
+ detour?: ListenDetour;
766
+ }
767
+ interface InboundTLSOptions$1 {
768
+ enabled?: boolean;
769
+ server_name?: string;
770
+ insecure?: boolean;
771
+ alpn?: string | string[];
772
+ min_version?: "1.0" | "1.1" | "1.2" | "1.3";
773
+ max_version?: "1.0" | "1.1" | "1.2" | "1.3";
774
+ cipher_suites?: string | string[];
775
+ curve_preferences?: ("P256" | "P384" | "P521" | "X25519" | "X25519MLKEM768") | ("P256" | "P384" | "P521" | "X25519" | "X25519MLKEM768")[];
776
+ certificate?: string | string[];
777
+ certificate_path?: string;
778
+ client_authentication?: "no" | "request" | "require-any" | "verify-if-given" | "require-and-verify";
779
+ client_certificate?: string | string[];
780
+ client_certificate_path?: string | string[];
781
+ client_certificate_public_key_sha256?: (string | number[]) | (string | number[])[];
782
+ key?: string | string[];
783
+ key_path?: string;
784
+ kernel_tx?: boolean;
785
+ kernel_rx?: boolean;
786
+ handshake_timeout?: Duration$1;
787
+ certificate_provider?: CertificateProviderReference$1;
788
+ ech?: InboundECHOptions$1;
789
+ reality?: InboundRealityOptions$1;
790
+ }
791
+ interface ACMEExternalAccountOptions$1 {
792
+ key_id?: string;
793
+ mac_key?: string;
794
+ }
795
+ interface HTTPHeader$1 {
796
+ [k: string]: string | string[];
797
+ }
798
+ interface OutboundTLSOptions$1 {
799
+ enabled?: boolean;
800
+ engine?: "go" | "apple" | "windows";
801
+ disable_sni?: boolean;
802
+ server_name?: string;
803
+ insecure?: boolean;
804
+ alpn?: string | string[];
805
+ min_version?: "1.0" | "1.1" | "1.2" | "1.3";
806
+ max_version?: "1.0" | "1.1" | "1.2" | "1.3";
807
+ cipher_suites?: string | string[];
808
+ curve_preferences?: ("P256" | "P384" | "P521" | "X25519" | "X25519MLKEM768") | ("P256" | "P384" | "P521" | "X25519" | "X25519MLKEM768")[];
809
+ certificate?: string | string[];
810
+ certificate_path?: string;
811
+ certificate_public_key_sha256?: (string | number[]) | (string | number[])[];
812
+ client_certificate?: string | string[];
813
+ client_certificate_path?: string;
814
+ client_key?: string | string[];
815
+ client_key_path?: string;
816
+ fragment?: boolean;
817
+ fragment_fallback_delay?: Duration$1;
818
+ record_fragment?: boolean;
819
+ spoof?: string;
820
+ spoof_method?: "wrong-sequence" | "wrong-checksum" | "wrong-ack" | "wrong-md5" | "wrong-timestamp";
821
+ kernel_tx?: boolean;
822
+ kernel_rx?: boolean;
823
+ handshake_timeout?: Duration$1;
824
+ ech?: OutboundECHOptions$1;
825
+ utls?: OutboundUTLSOptions$1;
826
+ reality?: OutboundRealityOptions$1;
827
+ }
828
+ interface OutboundECHOptions$1 {
829
+ enabled?: boolean;
830
+ config?: string | string[];
831
+ config_path?: string;
832
+ query_server_name?: string;
833
+ }
834
+ interface OutboundUTLSOptions$1 {
835
+ enabled?: boolean;
836
+ fingerprint?: "chrome_psk" | "chrome_psk_shuffle" | "chrome_padding_psk_shuffle" | "chrome_pq" | "chrome_pq_psk" | "chrome" | "firefox" | "edge" | "safari" | "360" | "qq" | "ios" | "android" | "random" | "randomized";
837
+ }
838
+ interface OutboundRealityOptions$1 {
839
+ enabled?: boolean;
840
+ public_key?: string;
841
+ short_id?: string;
842
+ }
843
+ interface InboundECHOptions$1 {
844
+ enabled?: boolean;
845
+ key?: string | string[];
846
+ key_path?: string;
847
+ }
848
+ interface InboundRealityOptions$1 {
849
+ enabled?: boolean;
850
+ handshake?: InboundRealityHandshakeOptions$1;
851
+ private_key?: string;
852
+ short_id?: string | string[];
853
+ max_time_difference?: Duration$1;
854
+ }
855
+ interface InboundRealityHandshakeOptions$1 {
856
+ server?: string;
857
+ server_port?: number;
858
+ detour?: Egress;
859
+ bind_interface?: string;
860
+ inet4_bind_address?: string;
861
+ inet6_bind_address?: string;
862
+ bind_address_no_port?: boolean;
863
+ protect_path?: string;
864
+ routing_mark?: number | string;
865
+ reuse_addr?: boolean;
866
+ netns?: Namespace | string;
867
+ connect_timeout?: Duration$1;
868
+ tcp_fast_open?: boolean;
869
+ tcp_multi_path?: boolean;
870
+ disable_tcp_keep_alive?: boolean;
871
+ tcp_keep_alive?: Duration$1;
872
+ tcp_keep_alive_interval?: Duration$1;
873
+ udp_fragment?: boolean;
874
+ domain_resolver?: DomainResolver$2;
875
+ network_strategy?: "default" | "fallback" | "hybrid";
876
+ network_type?: InterfaceType$1 | InterfaceType$1[];
877
+ fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
878
+ fallback_delay?: Duration$1;
879
+ }
880
+ interface InboundCloudflaredOptions {
881
+ tag: string;
882
+ token?: string;
883
+ ha_connections?: number;
884
+ protocol?: "auto" | "quic" | "http2" | "h2mux";
885
+ post_quantum?: boolean;
886
+ edge_ip_version?: 0 | 4 | 6;
887
+ datagram_version?: "v2" | "v3";
888
+ grace_period?: Duration$1;
889
+ region?: string;
890
+ control_dialer?: DialerOptions$1;
891
+ tunnel_dialer?: DialerOptions$1;
892
+ }
893
+ interface DialerOptions$1 {
894
+ detour?: Egress;
895
+ bind_interface?: string;
896
+ inet4_bind_address?: string;
897
+ inet6_bind_address?: string;
898
+ bind_address_no_port?: boolean;
899
+ protect_path?: string;
900
+ routing_mark?: number | string;
901
+ reuse_addr?: boolean;
902
+ netns?: Namespace | string;
903
+ connect_timeout?: Duration$1;
904
+ tcp_fast_open?: boolean;
905
+ tcp_multi_path?: boolean;
906
+ disable_tcp_keep_alive?: boolean;
907
+ tcp_keep_alive?: Duration$1;
908
+ tcp_keep_alive_interval?: Duration$1;
909
+ udp_fragment?: boolean;
910
+ domain_resolver?: DomainResolver$2;
911
+ network_strategy?: "default" | "fallback" | "hybrid";
912
+ network_type?: InterfaceType$1 | InterfaceType$1[];
913
+ fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
914
+ fallback_delay?: Duration$1;
915
+ }
916
+ interface InboundDirectOptions {
917
+ tag: string;
918
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
919
+ override_address?: string;
920
+ override_port?: number;
921
+ }
922
+ interface InboundHttpOptions {
923
+ tag: string;
924
+ users?: User$2[];
925
+ set_system_proxy?: boolean;
926
+ }
927
+ interface User$2 {
928
+ username?: string;
929
+ password?: string;
930
+ }
931
+ interface InboundHttpListen {
932
+ port?: number;
933
+ bind_interface?: string;
934
+ routing_mark?: number | string;
935
+ reuse_addr?: boolean;
936
+ netns?: Namespace | string;
937
+ disable_tcp_keep_alive?: boolean;
938
+ tcp_keep_alive?: Duration$1;
939
+ tcp_keep_alive_interval?: Duration$1;
940
+ tcp_fast_open?: boolean;
941
+ tcp_multi_path?: boolean;
942
+ udp_fragment?: boolean;
943
+ udp_timeout?: UDPTimeout$1;
944
+ detour?: ListenDetour;
945
+ domain_resolver?: DomainResolver$2;
946
+ }
947
+ interface InboundHysteriaOptions {
948
+ tag: string;
949
+ up?: number | string;
950
+ up_mbps?: number;
951
+ down?: number | string;
952
+ down_mbps?: number;
953
+ obfs?: string;
954
+ users?: HysteriaUser$1[];
955
+ idle_timeout?: Duration$1;
956
+ keep_alive_period?: Duration$1;
957
+ stream_receive_window?: number | string;
958
+ connection_receive_window?: number | string;
959
+ max_concurrent_streams?: number;
960
+ initial_packet_size?: number;
961
+ disable_path_mtu_discovery?: boolean;
962
+ }
963
+ interface HysteriaUser$1 {
964
+ name?: string;
965
+ auth?: string | number[];
966
+ auth_str?: string;
967
+ }
968
+ interface InboundHysteria2Options {
969
+ tag: string;
970
+ up_mbps?: number;
971
+ down_mbps?: number;
972
+ obfs?: {
973
+ type: "salamander";
974
+ password?: string;
975
+ } | {
976
+ type: "gecko";
977
+ password?: string;
978
+ min_packet_size?: number;
979
+ max_packet_size?: number;
980
+ };
981
+ users?: Hysteria2User$1[];
982
+ ignore_client_bandwidth?: boolean;
983
+ idle_timeout?: Duration$1;
984
+ keep_alive_period?: Duration$1;
985
+ stream_receive_window?: number | string;
986
+ connection_receive_window?: number | string;
987
+ max_concurrent_streams?: number;
988
+ initial_packet_size?: number;
989
+ disable_path_mtu_discovery?: boolean;
990
+ masquerade?: string | ({
991
+ type: "file";
992
+ directory?: string;
993
+ } | {
994
+ type: "proxy";
995
+ url?: string;
996
+ rewrite_host?: boolean;
997
+ } | {
998
+ type: "string";
999
+ status_code?: number;
1000
+ headers?: HTTPHeader$1;
1001
+ content?: string;
1002
+ });
1003
+ bbr_profile?: "standard" | "conservative" | "aggressive";
1004
+ brutal_debug?: boolean;
1005
+ realm?: Hysteria2InboundRealm$1;
1006
+ }
1007
+ interface Hysteria2User$1 {
1008
+ name?: string;
1009
+ password?: string;
1010
+ }
1011
+ interface Hysteria2InboundRealm$1 {
1012
+ server_url?: string;
1013
+ token?: string;
1014
+ realm_id?: string;
1015
+ stun_servers?: string | string[];
1016
+ ip_version?: 0 | 4 | 6;
1017
+ port_mapping?: Hysteria2RealmPortMapping$1;
1018
+ http_client?: HTTPClientReference$1;
1019
+ stun_domain_resolver?: DomainResolver$2;
1020
+ }
1021
+ interface Hysteria2RealmPortMapping$1 {
1022
+ enabled?: boolean;
1023
+ timeout?: Duration$1;
1024
+ lifetime?: Duration$1;
1025
+ }
1026
+ interface InboundNaiveOptions {
1027
+ tag: string;
1028
+ users?: User$2[];
1029
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1030
+ quic_congestion_control?: "bbr" | "cubic" | "reno";
1031
+ }
1032
+ interface InboundRedirectOptions {
1033
+ tag: string;
1034
+ }
1035
+ interface InboundShadowsocksOptions {
1036
+ tag: string;
1037
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1038
+ method: "none" | "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm" | "chacha20-ietf-poly1305" | "xchacha20-ietf-poly1305" | "2022-blake3-aes-128-gcm" | "2022-blake3-aes-256-gcm" | "2022-blake3-chacha20-poly1305";
1039
+ password?: string;
1040
+ users?: ShadowsocksUser$1[];
1041
+ destinations?: ShadowsocksDestination$1[];
1042
+ multiplex?: InboundMultiplexOptions$1;
1043
+ managed?: boolean;
1044
+ }
1045
+ interface ShadowsocksUser$1 {
1046
+ name?: string;
1047
+ password?: string;
1048
+ }
1049
+ interface ShadowsocksDestination$1 {
1050
+ name?: string;
1051
+ password?: string;
1052
+ server?: string;
1053
+ server_port?: number;
1054
+ }
1055
+ interface InboundMultiplexOptions$1 {
1056
+ enabled?: boolean;
1057
+ padding?: boolean;
1058
+ brutal?: BrutalOptions$1;
1059
+ }
1060
+ interface BrutalOptions$1 {
1061
+ enabled?: boolean;
1062
+ up_mbps?: number;
1063
+ down_mbps?: number;
1064
+ }
1065
+ interface InboundShadowtlsOptions {
1066
+ tag: string;
1067
+ version?: 1 | 2 | 3;
1068
+ password?: string;
1069
+ users?: ShadowTLSUser$1[];
1070
+ handshake?: ShadowTLSHandshakeOptions$1;
1071
+ handshake_for_server_name?: {
1072
+ [k: string]: ShadowTLSHandshakeOptions$1;
1073
+ };
1074
+ strict_mode?: boolean;
1075
+ wildcard_sni?: "" | "off" | "authed" | "all";
1076
+ }
1077
+ interface ShadowTLSUser$1 {
1078
+ name?: string;
1079
+ password?: string;
1080
+ }
1081
+ interface ShadowTLSHandshakeOptions$1 {
1082
+ server?: string;
1083
+ server_port?: number;
1084
+ detour?: Egress;
1085
+ bind_interface?: string;
1086
+ inet4_bind_address?: string;
1087
+ inet6_bind_address?: string;
1088
+ bind_address_no_port?: boolean;
1089
+ protect_path?: string;
1090
+ routing_mark?: number | string;
1091
+ reuse_addr?: boolean;
1092
+ netns?: Namespace | string;
1093
+ connect_timeout?: Duration$1;
1094
+ tcp_fast_open?: boolean;
1095
+ tcp_multi_path?: boolean;
1096
+ disable_tcp_keep_alive?: boolean;
1097
+ tcp_keep_alive?: Duration$1;
1098
+ tcp_keep_alive_interval?: Duration$1;
1099
+ udp_fragment?: boolean;
1100
+ domain_resolver?: DomainResolver$2;
1101
+ network_strategy?: "default" | "fallback" | "hybrid";
1102
+ network_type?: InterfaceType$1 | InterfaceType$1[];
1103
+ fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
1104
+ fallback_delay?: Duration$1;
1105
+ }
1106
+ interface SnellUser$1 {
1107
+ name?: string;
1108
+ userkey?: string;
1109
+ }
1110
+ interface InboundSocksOptions {
1111
+ tag: string;
1112
+ users?: User$2[];
1113
+ }
1114
+ interface InboundTproxyOptions {
1115
+ tag: string;
1116
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1117
+ udp_mapping?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1118
+ udp_filtering?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1119
+ udp_nat_max?: number;
1120
+ }
1121
+ interface InboundTrojanOptions {
1122
+ tag: string;
1123
+ users?: TrojanUser$1[];
1124
+ fallback?: ServerOptions$1;
1125
+ fallback_for_alpn?: {
1126
+ [k: string]: ServerOptions$1;
1127
+ };
1128
+ multiplex?: InboundMultiplexOptions$1;
1129
+ transport?: V2RayTransport$1;
1130
+ }
1131
+ interface TrojanUser$1 {
1132
+ name?: string;
1133
+ password?: string;
1134
+ }
1135
+ interface ServerOptions$1 {
1136
+ server?: string;
1137
+ server_port?: number;
1138
+ }
1139
+ interface InboundTuicOptions {
1140
+ tag: string;
1141
+ users?: TUICUser$1[];
1142
+ congestion_control?: "cubic" | "new_reno" | "bbr";
1143
+ auth_timeout?: Duration$1;
1144
+ zero_rtt_handshake?: boolean;
1145
+ heartbeat?: Duration$1;
1146
+ idle_timeout?: Duration$1;
1147
+ keep_alive_period?: Duration$1;
1148
+ stream_receive_window?: number | string;
1149
+ connection_receive_window?: number | string;
1150
+ max_concurrent_streams?: number;
1151
+ initial_packet_size?: number;
1152
+ disable_path_mtu_discovery?: boolean;
1153
+ }
1154
+ interface TUICUser$1 {
1155
+ name?: string;
1156
+ uuid?: string;
1157
+ password?: string;
1158
+ }
1159
+ interface InboundTunOptions {
1160
+ tag: string;
1161
+ interface_name?: string;
1162
+ mtu?: number;
1163
+ address?: string | string[];
1164
+ dns_mode?: "disabled" | "native" | "hijack";
1165
+ dns_address?: string | string[];
1166
+ auto_route?: boolean;
1167
+ iproute2_table_index?: number;
1168
+ iproute2_rule_index?: number;
1169
+ auto_redirect?: boolean;
1170
+ auto_redirect_input_mark?: number | string;
1171
+ auto_redirect_output_mark?: number | string;
1172
+ auto_redirect_reset_mark?: number | string;
1173
+ auto_redirect_nfqueue?: number;
1174
+ auto_redirect_iproute2_fallback_rule_index?: number;
1175
+ exclude_mptcp?: boolean;
1176
+ loopback_address?: string | string[];
1177
+ strict_route?: boolean;
1178
+ route_address?: string | string[];
1179
+ route_address_set?: string | string[];
1180
+ route_exclude_address?: string | string[];
1181
+ route_exclude_address_set?: string | string[];
1182
+ include_interface?: string | string[];
1183
+ exclude_interface?: string | string[];
1184
+ include_uid?: number | number[];
1185
+ include_uid_range?: string | string[];
1186
+ exclude_uid?: number | number[];
1187
+ exclude_uid_range?: string | string[];
1188
+ include_android_user?: number | number[];
1189
+ include_package?: string | string[];
1190
+ exclude_package?: string | string[];
1191
+ include_mac_address?: string | string[];
1192
+ exclude_mac_address?: string | string[];
1193
+ udp_mapping?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1194
+ udp_filtering?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1195
+ udp_nat_max?: number;
1196
+ stack?: "system" | "gvisor" | "mixed";
1197
+ platform?: TunPlatformOptions$1;
1198
+ }
1199
+ interface TunPlatformOptions$1 {
1200
+ http_proxy?: HTTPProxyOptions$1;
1201
+ }
1202
+ interface HTTPProxyOptions$1 {
1203
+ enabled?: boolean;
1204
+ server?: string;
1205
+ server_port?: number;
1206
+ bypass_domain?: string | string[];
1207
+ match_domain?: string | string[];
1208
+ }
1209
+ interface InboundTunListen {
1210
+ netns?: Namespace | string;
1211
+ udp_timeout?: UDPTimeout$1;
1212
+ }
1213
+ interface InboundVlessOptions {
1214
+ tag: string;
1215
+ users: VLESSUser$1[];
1216
+ multiplex?: InboundMultiplexOptions$1;
1217
+ transport?: V2RayTransport$1;
1218
+ }
1219
+ interface VLESSUser$1 {
1220
+ name?: string;
1221
+ uuid?: string;
1222
+ flow?: string;
1223
+ }
1224
+ interface InboundVmessOptions {
1225
+ tag: string;
1226
+ users?: VMessUser$1[];
1227
+ multiplex?: InboundMultiplexOptions$1;
1228
+ transport?: V2RayTransport$1;
1229
+ }
1230
+ interface VMessUser$1 {
1231
+ name?: string;
1232
+ uuid?: string;
1233
+ alterId?: number;
1234
+ }
1235
+ interface OutboundAnytlsOptions {
1236
+ tag: string;
1237
+ server?: string;
1238
+ server_port?: number;
1239
+ password?: string;
1240
+ idle_session_check_interval?: Duration$1;
1241
+ idle_session_timeout?: Duration$1;
1242
+ min_idle_session?: number;
1243
+ client_metadata?: string;
1244
+ }
1245
+ interface OutboundAnytlsDial {
1246
+ detour?: Egress;
1247
+ bind_interface?: string;
1248
+ inet4_bind_address?: string;
1249
+ inet6_bind_address?: string;
1250
+ bind_address_no_port?: boolean;
1251
+ protect_path?: string;
1252
+ routing_mark?: number | string;
1253
+ reuse_addr?: boolean;
1254
+ netns?: Namespace | string;
1255
+ connect_timeout?: Duration$1;
1256
+ tcp_fast_open?: boolean;
1257
+ tcp_multi_path?: boolean;
1258
+ disable_tcp_keep_alive?: boolean;
1259
+ tcp_keep_alive?: Duration$1;
1260
+ tcp_keep_alive_interval?: Duration$1;
1261
+ udp_fragment?: boolean;
1262
+ domain_resolver?: DomainResolver$2;
1263
+ network_strategy?: "default" | "fallback" | "hybrid";
1264
+ network_type?: InterfaceType$1 | InterfaceType$1[];
1265
+ fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
1266
+ fallback_delay?: Duration$1;
1267
+ }
1268
+ interface OutboundBridgeOptions {
1269
+ tag: string;
1270
+ interface?: string;
1271
+ bridge_name?: string;
1272
+ iproute2_table_index?: number;
1273
+ iproute2_rule_index?: number;
1274
+ }
1275
+ interface OutboundDirectDial {
1276
+ bind_interface?: string;
1277
+ inet4_bind_address?: string;
1278
+ inet6_bind_address?: string;
1279
+ bind_address_no_port?: boolean;
1280
+ protect_path?: string;
1281
+ routing_mark?: number | string;
1282
+ reuse_addr?: boolean;
1283
+ netns?: Namespace | string;
1284
+ connect_timeout?: Duration$1;
1285
+ tcp_fast_open?: boolean;
1286
+ tcp_multi_path?: boolean;
1287
+ disable_tcp_keep_alive?: boolean;
1288
+ tcp_keep_alive?: Duration$1;
1289
+ tcp_keep_alive_interval?: Duration$1;
1290
+ udp_fragment?: boolean;
1291
+ domain_resolver?: DomainResolver$2;
1292
+ network_strategy?: "default" | "fallback" | "hybrid";
1293
+ network_type?: InterfaceType$1 | InterfaceType$1[];
1294
+ fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
1295
+ fallback_delay?: Duration$1;
1296
+ }
1297
+ interface OutboundHttpOptions {
1298
+ tag: string;
1299
+ server?: string;
1300
+ server_port?: number;
1301
+ username?: string;
1302
+ password?: string;
1303
+ path?: string;
1304
+ headers?: HTTPHeader$1;
1305
+ }
1306
+ interface OutboundHysteriaOptions {
1307
+ tag: string;
1308
+ server?: string;
1309
+ server_port?: number;
1310
+ server_ports?: string | string[];
1311
+ hop_interval?: Duration$1;
1312
+ up?: number | string;
1313
+ up_mbps?: number;
1314
+ down?: number | string;
1315
+ down_mbps?: number;
1316
+ obfs?: string;
1317
+ auth?: string | number[];
1318
+ auth_str?: string;
1319
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1320
+ idle_timeout?: Duration$1;
1321
+ keep_alive_period?: Duration$1;
1322
+ stream_receive_window?: number | string;
1323
+ connection_receive_window?: number | string;
1324
+ max_concurrent_streams?: number;
1325
+ initial_packet_size?: number;
1326
+ disable_path_mtu_discovery?: boolean;
1327
+ }
1328
+ interface OutboundHysteria2Options {
1329
+ tag: string;
1330
+ server?: string;
1331
+ server_port?: number;
1332
+ server_ports?: string | string[];
1333
+ hop_interval?: Duration$1;
1334
+ hop_interval_max?: Duration$1;
1335
+ up_mbps?: number;
1336
+ down_mbps?: number;
1337
+ obfs?: {
1338
+ type: "salamander";
1339
+ password?: string;
1340
+ } | {
1341
+ type: "gecko";
1342
+ password?: string;
1343
+ min_packet_size?: number;
1344
+ max_packet_size?: number;
1345
+ };
1346
+ password?: string;
1347
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1348
+ idle_timeout?: Duration$1;
1349
+ keep_alive_period?: Duration$1;
1350
+ stream_receive_window?: number | string;
1351
+ connection_receive_window?: number | string;
1352
+ max_concurrent_streams?: number;
1353
+ initial_packet_size?: number;
1354
+ disable_path_mtu_discovery?: boolean;
1355
+ bbr_profile?: "standard" | "conservative" | "aggressive";
1356
+ brutal_debug?: boolean;
1357
+ disable_chrome_parrot?: boolean;
1358
+ realm?: Hysteria2Realm$1;
1359
+ }
1360
+ interface Hysteria2Realm$1 {
1361
+ server_url?: string;
1362
+ token?: string;
1363
+ realm_id?: string;
1364
+ stun_servers?: string | string[];
1365
+ ip_version?: 0 | 4 | 6;
1366
+ port_mapping?: Hysteria2RealmPortMapping$1;
1367
+ http_client?: HTTPClientReference$1;
1368
+ }
1369
+ interface OutboundNaiveOptions {
1370
+ tag: string;
1371
+ server?: string;
1372
+ server_port?: number;
1373
+ username?: string;
1374
+ password?: string;
1375
+ insecure_concurrency?: number;
1376
+ extra_headers?: HTTPHeader$1;
1377
+ stream_receive_window?: number | string;
1378
+ udp_over_tcp?: boolean | {
1379
+ enabled?: boolean;
1380
+ version?: 1 | 2;
1381
+ };
1382
+ quic?: boolean;
1383
+ quic_congestion_control?: "bbr" | "bbr2" | "cubic" | "reno";
1384
+ quic_session_receive_window?: number | string;
1385
+ }
1386
+ interface OutboundSelectorOptions {
1387
+ tag: string;
1388
+ outbounds: Egress[];
1389
+ default?: Egress;
1390
+ interrupt_exist_connections?: boolean;
1391
+ }
1392
+ interface OutboundShadowsocksOptions {
1393
+ tag: string;
1394
+ server?: string;
1395
+ server_port?: number;
1396
+ method?: "none" | "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm" | "chacha20-ietf-poly1305" | "xchacha20-ietf-poly1305" | "2022-blake3-aes-128-gcm" | "2022-blake3-aes-256-gcm" | "2022-blake3-chacha20-poly1305" | "aes-128-ctr" | "aes-192-ctr" | "aes-256-ctr" | "aes-128-cfb" | "aes-192-cfb" | "aes-256-cfb" | "rc4-md5" | "chacha20-ietf" | "xchacha20";
1397
+ password?: string;
1398
+ plugin?: string;
1399
+ plugin_opts?: string;
1400
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1401
+ udp_over_tcp?: boolean | {
1402
+ enabled?: boolean;
1403
+ version?: 1 | 2;
1404
+ };
1405
+ multiplex?: OutboundMultiplexOptions$1;
1406
+ }
1407
+ interface OutboundMultiplexOptions$1 {
1408
+ enabled?: boolean;
1409
+ protocol?: "h2mux" | "smux" | "yamux";
1410
+ max_connections?: number;
1411
+ min_streams?: number;
1412
+ max_streams?: number;
1413
+ padding?: boolean;
1414
+ brutal?: BrutalOptions$1;
1415
+ }
1416
+ interface OutboundShadowtlsOptions {
1417
+ tag: string;
1418
+ server?: string;
1419
+ server_port?: number;
1420
+ version?: 1 | 2 | 3;
1421
+ password?: string;
1422
+ }
1423
+ interface OutboundSocksOptions {
1424
+ tag: string;
1425
+ server?: string;
1426
+ server_port?: number;
1427
+ version?: "4" | "4a" | "5";
1428
+ username?: string;
1429
+ password?: string;
1430
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1431
+ udp_over_tcp?: boolean | {
1432
+ enabled?: boolean;
1433
+ version?: 1 | 2;
1434
+ };
1435
+ }
1436
+ interface OutboundSshOptions {
1437
+ tag: string;
1438
+ server?: string;
1439
+ server_port?: number;
1440
+ user?: string;
1441
+ password?: string;
1442
+ private_key?: string | string[];
1443
+ private_key_path?: string;
1444
+ private_key_passphrase?: string;
1445
+ host_key?: string | string[];
1446
+ host_key_algorithms?: string | string[];
1447
+ client_version?: string;
1448
+ cipher?: string | string[];
1449
+ mac?: string | string[];
1450
+ kex_algorithm?: string | string[];
1451
+ }
1452
+ interface OutboundTorOptions {
1453
+ tag: string;
1454
+ executable_path?: string;
1455
+ extra_args?: string[];
1456
+ data_directory?: string;
1457
+ torrc?: {
1458
+ [k: string]: string;
1459
+ };
1460
+ }
1461
+ interface OutboundTrojanOptions {
1462
+ tag: string;
1463
+ server?: string;
1464
+ server_port?: number;
1465
+ password?: string;
1466
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1467
+ multiplex?: OutboundMultiplexOptions$1;
1468
+ transport?: V2RayTransport$1;
1469
+ }
1470
+ interface OutboundTuicOptions {
1471
+ tag: string;
1472
+ server?: string;
1473
+ server_port?: number;
1474
+ uuid?: string;
1475
+ password?: string;
1476
+ congestion_control?: "cubic" | "new_reno" | "bbr";
1477
+ udp_relay_mode?: "native" | "quic";
1478
+ udp_over_stream?: boolean;
1479
+ zero_rtt_handshake?: boolean;
1480
+ heartbeat?: Duration$1;
1481
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1482
+ idle_timeout?: Duration$1;
1483
+ keep_alive_period?: Duration$1;
1484
+ stream_receive_window?: number | string;
1485
+ connection_receive_window?: number | string;
1486
+ max_concurrent_streams?: number;
1487
+ initial_packet_size?: number;
1488
+ disable_path_mtu_discovery?: boolean;
1489
+ }
1490
+ interface OutboundUrltestOptions {
1491
+ tag: string;
1492
+ outbounds: Egress[];
1493
+ url?: string;
1494
+ interval?: Duration$1;
1495
+ tolerance?: number;
1496
+ idle_timeout?: Duration$1;
1497
+ interrupt_exist_connections?: boolean;
1498
+ }
1499
+ interface OutboundVlessOptions {
1500
+ tag: string;
1501
+ server: string;
1502
+ server_port: number;
1503
+ uuid: string;
1504
+ flow?: string;
1505
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1506
+ multiplex?: OutboundMultiplexOptions$1;
1507
+ transport?: V2RayTransport$1;
1508
+ packet_encoding?: string;
1509
+ }
1510
+ interface OutboundVmessOptions {
1511
+ tag: string;
1512
+ server?: string;
1513
+ server_port?: number;
1514
+ uuid?: string;
1515
+ security?: "auto" | "none" | "zero" | "aes-128-cfb" | "aes-128-gcm" | "chacha20-poly1305";
1516
+ alter_id?: number;
1517
+ global_padding?: boolean;
1518
+ authenticated_length?: boolean;
1519
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
1520
+ packet_encoding?: "packetaddr" | "xudp";
1521
+ multiplex?: OutboundMultiplexOptions$1;
1522
+ transport?: V2RayTransport$1;
1523
+ }
1524
+ interface EndpointOpenconnectOptions {
1525
+ tag: string;
1526
+ system?: boolean;
1527
+ name?: string;
1528
+ udp_timeout?: Duration$1;
1529
+ udp_mapping?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1530
+ udp_filtering?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1531
+ udp_nat_max?: number;
1532
+ server?: string;
1533
+ flavor?: "anyconnect" | "gp" | "fortinet" | "f5" | "pulse" | "nc";
1534
+ username?: string;
1535
+ password?: string;
1536
+ auth_group?: string;
1537
+ cookie?: string;
1538
+ token?: OpenConnectTokenOptions$1;
1539
+ reported_os?: string;
1540
+ user_agent?: string;
1541
+ version?: string;
1542
+ local_hostname?: string;
1543
+ mobile?: OpenConnectMobileOptions$1;
1544
+ csd?: OpenConnectCSDOptions$1;
1545
+ hip?: OpenConnectHIPOptions$1;
1546
+ tncc?: OpenConnectTNCCOptions$1;
1547
+ fortinet_host_check?: OpenConnectFortinetHostCheckOptions$1;
1548
+ no_udp?: boolean;
1549
+ dtls_local_port?: number;
1550
+ compression_disabled?: boolean;
1551
+ compression_mode?: "stateless" | "all";
1552
+ ipv6_disabled?: boolean;
1553
+ http_keepalive_disabled?: boolean;
1554
+ xml_post_disabled?: boolean;
1555
+ external_auth_disabled?: boolean;
1556
+ password_authentication_disabled?: boolean;
1557
+ tcp_keep_alive_enabled?: boolean;
1558
+ pfs?: boolean;
1559
+ mtu?: number;
1560
+ base_mtu?: number;
1561
+ dpd_interval?: Duration$1;
1562
+ reconnect_timeout?: Duration$1;
1563
+ trojan_interval?: Duration$1;
1564
+ queue_length?: number;
1565
+ allow_insecure_crypto?: boolean;
1566
+ form_entries?: OpenConnectFormEntryOptions$1[];
1567
+ }
1568
+ interface OpenConnectTokenOptions$1 {
1569
+ mode?: "totp" | "hotp" | "stoken" | "oidc";
1570
+ secret?: string;
1571
+ secret_path?: string;
1572
+ pin?: string;
1573
+ password?: string;
1574
+ device_id?: string;
1575
+ counter?: number;
1576
+ }
1577
+ interface OpenConnectMobileOptions$1 {
1578
+ platform_version?: string;
1579
+ device_type?: string;
1580
+ device_unique_id?: string;
1581
+ }
1582
+ interface OpenConnectCSDOptions$1 {
1583
+ wrapper_path?: string;
1584
+ }
1585
+ interface OpenConnectHIPOptions$1 {
1586
+ wrapper_path?: string;
1587
+ }
1588
+ interface OpenConnectTNCCOptions$1 {
1589
+ wrapper_path?: string;
1590
+ device_id?: string;
1591
+ user_agent?: string;
1592
+ machine_identification_enabled?: boolean;
1593
+ certificates?: OpenConnectTNCCCertificateOptions$1[];
1594
+ }
1595
+ interface OpenConnectTNCCCertificateOptions$1 {
1596
+ certificate?: string | string[];
1597
+ certificate_path?: string;
1598
+ }
1599
+ interface OpenConnectFortinetHostCheckOptions$1 {
1600
+ hostcheck?: string;
1601
+ check_virtual_desktop?: string;
1602
+ }
1603
+ interface OpenConnectFormEntryOptions$1 {
1604
+ form_id?: string;
1605
+ submission_key?: string;
1606
+ name?: string;
1607
+ value?: string;
1608
+ promote?: boolean;
1609
+ }
1610
+ interface OpenConnectTLSOptions$1 {
1611
+ insecure?: boolean;
1612
+ server_name?: string;
1613
+ peer_fingerprint?: string | string[];
1614
+ system_trust_disabled?: boolean;
1615
+ certificate_authority?: string | string[];
1616
+ certificate_authority_path?: string;
1617
+ client_certificate?: string | string[];
1618
+ client_certificate_path?: string;
1619
+ client_key?: string | string[];
1620
+ client_key_path?: string;
1621
+ client_key_password?: string;
1622
+ mca_certificate?: string | string[];
1623
+ mca_certificate_path?: string;
1624
+ mca_key?: string | string[];
1625
+ mca_key_path?: string;
1626
+ mca_key_password?: string;
1627
+ }
1628
+ interface EndpointOpenvpnClientOptions {
1629
+ tag: string;
1630
+ server?: string;
1631
+ server_port?: number;
1632
+ system?: boolean;
1633
+ name?: string;
1634
+ mtu?: number;
1635
+ udp_mapping?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1636
+ udp_filtering?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1637
+ udp_nat_max?: number;
1638
+ mode?: "tls" | "static_key";
1639
+ network?: "udp" | "udp4" | "udp6" | "tcp" | "tcp4" | "tcp6";
1640
+ servers?: OpenVPNRemoteOptions$1[];
1641
+ remote_random?: boolean;
1642
+ address?: string | string[];
1643
+ peer_address?: string;
1644
+ peer_address_ipv6?: string;
1645
+ topology?: "net30" | "p2p" | "subnet";
1646
+ username?: string;
1647
+ password?: string;
1648
+ auth_retry?: "none" | "nointeract" | "interact";
1649
+ static_challenge?: string;
1650
+ static_challenge_echo?: boolean;
1651
+ static_key?: string | string[];
1652
+ static_key_path?: string;
1653
+ key_direction?: "server" | "client";
1654
+ cipher?: string;
1655
+ data_ciphers?: string | string[];
1656
+ data_ciphers_fallback?: string;
1657
+ auth?: string;
1658
+ mss_fix?: number;
1659
+ mss_fix_disabled?: boolean;
1660
+ mss_fix_mode?: "mtu" | "fixed";
1661
+ fragment?: number;
1662
+ replay_window?: number;
1663
+ replay_window_time?: Duration$1;
1664
+ compression?: "none" | "no" | "lz4" | "lz4-v2" | "stub" | "stub-v2" | "disabled" | "off";
1665
+ compression_lzo?: "none" | "no" | "yes" | "adaptive" | "asym" | "disabled" | "off";
1666
+ allow_compression?: "no" | "asym" | "yes";
1667
+ route_no_pull?: boolean;
1668
+ pull_filters?: OpenVPNPullFilterOptions$1[];
1669
+ routes?: string | string[];
1670
+ route_gateway?: string;
1671
+ route_metric?: number;
1672
+ redirect_gateway?: boolean;
1673
+ redirect_gateway_flags?: string | string[];
1674
+ redirect_private?: boolean;
1675
+ block_ipv6?: boolean;
1676
+ ping_interval?: Duration$1;
1677
+ ping_restart?: Duration$1;
1678
+ ping_restart_disabled?: boolean;
1679
+ renegotiate_interval?: Duration$1;
1680
+ renegotiate_disabled?: boolean;
1681
+ renegotiate_bytes?: number;
1682
+ renegotiate_packets?: number;
1683
+ tls_timeout?: Duration$1;
1684
+ handshake_window?: Duration$1;
1685
+ explicit_exit_notify?: number;
1686
+ udp_timeout?: UDPTimeout$1;
1687
+ }
1688
+ interface OpenVPNRemoteOptions$1 {
1689
+ server?: string;
1690
+ server_port?: number;
1691
+ network?: "udp" | "udp4" | "udp6" | "tcp" | "tcp4" | "tcp6";
1692
+ }
1693
+ interface OpenVPNPullFilterOptions$1 {
1694
+ action?: "accept" | "ignore" | "reject";
1695
+ text?: string;
1696
+ }
1697
+ interface OpenVPNOutboundTLSOptions$1 {
1698
+ server_name?: string;
1699
+ server_name_type?: "subject" | "name" | "name-prefix";
1700
+ certificate?: string | string[];
1701
+ certificate_path?: string;
1702
+ client_certificate?: string | string[];
1703
+ client_certificate_path?: string;
1704
+ client_key?: string | string[];
1705
+ client_key_path?: string;
1706
+ peer_fingerprint?: string | string[];
1707
+ crl_path?: string;
1708
+ remote_certificate_ku?: string | string[];
1709
+ remote_certificate_eku?: string;
1710
+ remote_certificate_tls?: "server" | "client" | "none";
1711
+ certificate_profile?: "legacy" | "preferred" | "insecure" | "suiteb";
1712
+ ns_certificate_type?: "server" | "client";
1713
+ version_min?: "1.0" | "1.1" | "1.2" | "1.3";
1714
+ version_max?: "1.0" | "1.1" | "1.2" | "1.3";
1715
+ cipher?: string;
1716
+ groups?: string;
1717
+ control_wrap?: OpenVPNControlWrapOptions$1;
1718
+ }
1719
+ interface OpenVPNControlWrapOptions$1 {
1720
+ type?: "tls_auth" | "tls_crypt" | "tls_crypt_v2";
1721
+ key?: string | string[];
1722
+ key_path?: string;
1723
+ direction?: "server" | "client";
1724
+ }
1725
+ interface EndpointOpenvpnServerOptions {
1726
+ tag: string;
1727
+ system?: boolean;
1728
+ name?: string;
1729
+ mtu?: number;
1730
+ udp_mapping?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1731
+ udp_filtering?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1732
+ udp_nat_max?: number;
1733
+ mode?: "tls" | "static_key";
1734
+ network?: "tcp" | "udp";
1735
+ remote?: string;
1736
+ remote_port?: number;
1737
+ max_clients?: number;
1738
+ address?: string | string[];
1739
+ peer_address?: string;
1740
+ peer_address_ipv6?: string;
1741
+ topology?: "net30" | "p2p" | "subnet";
1742
+ duplicate_cn?: boolean;
1743
+ users?: User$2[];
1744
+ static_key?: string | string[];
1745
+ static_key_path?: string;
1746
+ key_direction?: "server" | "client";
1747
+ cipher?: string;
1748
+ data_ciphers?: string | string[];
1749
+ data_ciphers_fallback?: string;
1750
+ auth?: string;
1751
+ mss_fix?: number;
1752
+ mss_fix_disabled?: boolean;
1753
+ mss_fix_mode?: "mtu" | "fixed";
1754
+ replay_window?: number;
1755
+ replay_window_time?: Duration$1;
1756
+ push?: OpenVPNPushOptions$1;
1757
+ ping_interval?: Duration$1;
1758
+ ping_restart?: Duration$1;
1759
+ renegotiate_interval?: Duration$1;
1760
+ renegotiate_disabled?: boolean;
1761
+ renegotiate_bytes?: number;
1762
+ renegotiate_packets?: number;
1763
+ handshake_window?: Duration$1;
1764
+ }
1765
+ interface OpenVPNPushOptions$1 {
1766
+ routes?: string | string[];
1767
+ dns?: string | string[];
1768
+ dns_servers?: OpenVPNPushDNSServerOptions$1[];
1769
+ search_domains?: string | string[];
1770
+ dhcp_options?: string | string[];
1771
+ redirect_gateway?: boolean;
1772
+ redirect_gateway_flags?: string | string[];
1773
+ block_outside_dns?: boolean;
1774
+ ping_interval?: Duration$1;
1775
+ ping_restart?: Duration$1;
1776
+ }
1777
+ interface OpenVPNPushDNSServerOptions$1 {
1778
+ priority?: number;
1779
+ addresses?: string | string[];
1780
+ resolve_domains?: string | string[];
1781
+ dnssec?: "yes" | "optional" | "no";
1782
+ transport?: "plain" | "dot" | "doh";
1783
+ sni?: string;
1784
+ }
1785
+ interface OpenVPNInboundTLSOptions$1 {
1786
+ certificate?: string | string[];
1787
+ certificate_path?: string;
1788
+ key?: string | string[];
1789
+ key_path?: string;
1790
+ client_certificate?: string | string[];
1791
+ client_certificate_path?: string;
1792
+ verify_client_certificate?: "require" | "optional" | "none";
1793
+ client_name?: string;
1794
+ client_name_type?: "subject" | "name" | "name-prefix";
1795
+ peer_fingerprint?: string | string[];
1796
+ crl_path?: string;
1797
+ remote_certificate_ku?: string | string[];
1798
+ remote_certificate_eku?: string;
1799
+ remote_certificate_tls?: "server" | "client" | "none";
1800
+ certificate_profile?: "legacy" | "preferred" | "insecure" | "suiteb";
1801
+ ns_certificate_type?: "server" | "client";
1802
+ version_min?: "1.0" | "1.1" | "1.2" | "1.3";
1803
+ version_max?: "1.0" | "1.1" | "1.2" | "1.3";
1804
+ cipher?: string;
1805
+ groups?: string;
1806
+ control_wrap?: OpenVPNInboundControlWrapOptions$1;
1807
+ }
1808
+ interface OpenVPNInboundControlWrapOptions$1 {
1809
+ type?: "tls_auth" | "tls_crypt" | "tls_crypt_v2";
1810
+ key?: string | string[];
1811
+ key_path?: string;
1812
+ direction?: "server" | "client";
1813
+ force_cookie?: boolean;
1814
+ }
1815
+ interface EndpointTailscaleOptions {
1816
+ tag: string;
1817
+ state_directory?: string;
1818
+ auth_key?: string;
1819
+ control_url?: string;
1820
+ ephemeral?: boolean;
1821
+ hostname?: string;
1822
+ accept_routes?: boolean;
1823
+ exit_node?: string;
1824
+ exit_node_allow_lan_access?: boolean;
1825
+ advertise_routes?: string[];
1826
+ advertise_exit_node?: boolean;
1827
+ advertise_tags?: string | string[];
1828
+ listen_port?: number;
1829
+ relay_server_port?: number;
1830
+ relay_server_static_endpoints?: string[];
1831
+ system_interface?: boolean;
1832
+ system_interface_name?: string;
1833
+ system_interface_mtu?: number;
1834
+ udp_timeout?: UDPTimeout$1;
1835
+ ssh_server?: boolean | {
1836
+ enabled?: boolean;
1837
+ disable_pty?: boolean;
1838
+ disable_sftp?: boolean;
1839
+ disable_forwarding?: boolean;
1840
+ };
1841
+ taildrop_directory?: string;
1842
+ }
1843
+ interface EndpointWireguardOptions {
1844
+ tag: string;
1845
+ system?: boolean;
1846
+ name?: string;
1847
+ mtu?: number;
1848
+ address: string | string[];
1849
+ private_key: string;
1850
+ listen_port?: number;
1851
+ peers?: WireGuardPeer$1[];
1852
+ udp_timeout?: Duration$1;
1853
+ udp_mapping?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1854
+ udp_filtering?: "" | "endpoint_independent" | "address_dependent" | "address_and_port_dependent";
1855
+ udp_nat_max?: number;
1856
+ workers?: number;
1857
+ }
1858
+ interface WireGuardPeer$1 {
1859
+ address?: string;
1860
+ port?: number;
1861
+ public_key?: string;
1862
+ pre_shared_key?: string;
1863
+ allowed_ips?: string | string[];
1864
+ persistent_keepalive_interval?: number;
1865
+ reserved?: string | number[];
1866
+ }
1867
+ interface ServiceApiOptions {
1868
+ tag?: string;
1869
+ secret?: string;
1870
+ access_control_allow_origin?: string | string[];
1871
+ access_control_allow_private_network?: boolean;
1872
+ dashboard?: boolean | string | {
1873
+ enabled?: boolean;
1874
+ path?: string;
1875
+ download_url?: string;
1876
+ http_client?: HTTPClientReference$1;
1877
+ update_interval?: Duration$1;
1878
+ };
1879
+ }
1880
+ interface ServiceCcmOptions {
1881
+ tag?: string;
1882
+ credential_path?: string;
1883
+ users?: CCMUser$1[];
1884
+ headers?: HTTPHeader$1;
1885
+ usages_path?: string;
1886
+ }
1887
+ interface CCMUser$1 {
1888
+ name?: string;
1889
+ token?: string;
1890
+ }
1891
+ interface ServiceCcmListen {
1892
+ port?: number;
1893
+ bind_interface?: string;
1894
+ routing_mark?: number | string;
1895
+ reuse_addr?: boolean;
1896
+ netns?: Namespace | string;
1897
+ disable_tcp_keep_alive?: boolean;
1898
+ tcp_keep_alive?: Duration$1;
1899
+ tcp_keep_alive_interval?: Duration$1;
1900
+ tcp_fast_open?: boolean;
1901
+ tcp_multi_path?: boolean;
1902
+ udp_fragment?: boolean;
1903
+ udp_timeout?: UDPTimeout$1;
1904
+ detour?: Egress;
1905
+ }
1906
+ interface ServiceDerpOptions {
1907
+ tag?: string;
1908
+ config_path?: string;
1909
+ verify_client_endpoint?: TailscaleEndpoint | TailscaleEndpoint[];
1910
+ verify_client_url?: (string | {
1911
+ tag?: string;
1912
+ engine?: "go" | "apple";
1913
+ version?: 0 | 1 | 2 | 3;
1914
+ disable_version_fallback?: boolean;
1915
+ headers?: HTTPHeader$1;
1916
+ tls?: OutboundTLSOptions$1;
1917
+ detour?: Egress;
1918
+ bind_interface?: string;
1919
+ inet4_bind_address?: string;
1920
+ inet6_bind_address?: string;
1921
+ bind_address_no_port?: boolean;
1922
+ protect_path?: string;
1923
+ routing_mark?: number | string;
1924
+ reuse_addr?: boolean;
1925
+ netns?: Namespace | string;
1926
+ connect_timeout?: Duration$1;
1927
+ tcp_fast_open?: boolean;
1928
+ tcp_multi_path?: boolean;
1929
+ disable_tcp_keep_alive?: boolean;
1930
+ tcp_keep_alive?: Duration$1;
1931
+ tcp_keep_alive_interval?: Duration$1;
1932
+ udp_fragment?: boolean;
1933
+ domain_resolver?: DomainResolver$2;
1934
+ network_strategy?: "default" | "fallback" | "hybrid";
1935
+ network_type?: InterfaceType$1 | InterfaceType$1[];
1936
+ fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
1937
+ fallback_delay?: Duration$1;
1938
+ idle_timeout?: Duration$1;
1939
+ keep_alive_period?: Duration$1;
1940
+ stream_receive_window?: number | string;
1941
+ connection_receive_window?: number | string;
1942
+ max_concurrent_streams?: number;
1943
+ initial_packet_size?: number;
1944
+ disable_path_mtu_discovery?: boolean;
1945
+ url?: string;
1946
+ }) | (string | {
1947
+ tag?: string;
1948
+ engine?: "go" | "apple";
1949
+ version?: 0 | 1 | 2 | 3;
1950
+ disable_version_fallback?: boolean;
1951
+ headers?: HTTPHeader$1;
1952
+ tls?: OutboundTLSOptions$1;
1953
+ detour?: Egress;
1954
+ bind_interface?: string;
1955
+ inet4_bind_address?: string;
1956
+ inet6_bind_address?: string;
1957
+ bind_address_no_port?: boolean;
1958
+ protect_path?: string;
1959
+ routing_mark?: number | string;
1960
+ reuse_addr?: boolean;
1961
+ netns?: Namespace | string;
1962
+ connect_timeout?: Duration$1;
1963
+ tcp_fast_open?: boolean;
1964
+ tcp_multi_path?: boolean;
1965
+ disable_tcp_keep_alive?: boolean;
1966
+ tcp_keep_alive?: Duration$1;
1967
+ tcp_keep_alive_interval?: Duration$1;
1968
+ udp_fragment?: boolean;
1969
+ domain_resolver?: DomainResolver$2;
1970
+ network_strategy?: "default" | "fallback" | "hybrid";
1971
+ network_type?: InterfaceType$1 | InterfaceType$1[];
1972
+ fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
1973
+ fallback_delay?: Duration$1;
1974
+ idle_timeout?: Duration$1;
1975
+ keep_alive_period?: Duration$1;
1976
+ stream_receive_window?: number | string;
1977
+ connection_receive_window?: number | string;
1978
+ max_concurrent_streams?: number;
1979
+ initial_packet_size?: number;
1980
+ disable_path_mtu_discovery?: boolean;
1981
+ url?: string;
1982
+ })[];
1983
+ home?: string;
1984
+ mesh_with?: DERPMeshOptions$1 | DERPMeshOptions$1[];
1985
+ mesh_psk?: string;
1986
+ mesh_psk_file?: string;
1987
+ stun?: number | {
1988
+ enabled?: boolean;
1989
+ listen?: string;
1990
+ listen_port?: number;
1991
+ bind_interface?: string;
1992
+ routing_mark?: number | string;
1993
+ reuse_addr?: boolean;
1994
+ netns?: Namespace | string;
1995
+ disable_tcp_keep_alive?: boolean;
1996
+ tcp_keep_alive?: Duration$1;
1997
+ tcp_keep_alive_interval?: Duration$1;
1998
+ tcp_fast_open?: boolean;
1999
+ tcp_multi_path?: boolean;
2000
+ udp_fragment?: boolean;
2001
+ udp_timeout?: UDPTimeout$1;
2002
+ detour?: ListenDetour;
2003
+ };
2004
+ }
2005
+ interface DERPMeshOptions$1 {
2006
+ server?: string;
2007
+ server_port?: number;
2008
+ host?: string;
2009
+ tls?: OutboundTLSOptions$1;
2010
+ detour?: Egress;
2011
+ bind_interface?: string;
2012
+ inet4_bind_address?: string;
2013
+ inet6_bind_address?: string;
2014
+ bind_address_no_port?: boolean;
2015
+ protect_path?: string;
2016
+ routing_mark?: number | string;
2017
+ reuse_addr?: boolean;
2018
+ netns?: Namespace | string;
2019
+ connect_timeout?: Duration$1;
2020
+ tcp_fast_open?: boolean;
2021
+ tcp_multi_path?: boolean;
2022
+ disable_tcp_keep_alive?: boolean;
2023
+ tcp_keep_alive?: Duration$1;
2024
+ tcp_keep_alive_interval?: Duration$1;
2025
+ udp_fragment?: boolean;
2026
+ domain_resolver?: DomainResolver$2;
2027
+ network_strategy?: "default" | "fallback" | "hybrid";
2028
+ network_type?: InterfaceType$1 | InterfaceType$1[];
2029
+ fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
2030
+ fallback_delay?: Duration$1;
2031
+ }
2032
+ interface ServiceHysteriaRealmOptions {
2033
+ tag?: string;
2034
+ idle_timeout?: Duration$1;
2035
+ keep_alive_period?: Duration$1;
2036
+ stream_receive_window?: number | string;
2037
+ connection_receive_window?: number | string;
2038
+ max_concurrent_streams?: number;
2039
+ users?: HysteriaRealmUser$1[];
2040
+ }
2041
+ interface HysteriaRealmUser$1 {
2042
+ name?: string;
2043
+ token?: string;
2044
+ max_realms?: number;
2045
+ }
2046
+ interface ServiceOcmOptions {
2047
+ tag?: string;
2048
+ credential_path?: string;
2049
+ users?: OCMUser$1[];
2050
+ headers?: HTTPHeader$1;
2051
+ usages_path?: string;
2052
+ }
2053
+ interface OCMUser$1 {
2054
+ name?: string;
2055
+ token?: string;
2056
+ }
2057
+ interface ServiceOomKillerOptions {
2058
+ tag?: string;
2059
+ memory_limit?: number | string;
2060
+ safety_margin?: number | string;
2061
+ min_interval?: Duration$1;
2062
+ max_interval?: Duration$1;
2063
+ }
2064
+ interface ServiceResolvedOptions {
2065
+ tag?: string;
2066
+ }
2067
+ interface ServiceSsmApiOptions {
2068
+ tag?: string;
2069
+ servers: {
2070
+ [k: string]: SsmInbound;
2071
+ };
2072
+ cache_path?: string;
2073
+ }
2074
+ interface ServiceUsbipClientOptions {
2075
+ tag?: string;
2076
+ server?: string;
2077
+ server_port?: number;
2078
+ devices?: USBIPDeviceMatch$1[];
2079
+ }
2080
+ interface USBIPDeviceMatch$1 {
2081
+ bus_id?: string;
2082
+ vendor_id?: number;
2083
+ product_id?: number;
2084
+ serial?: string;
2085
+ }
2086
+ interface HTTPClientHttpClientOptions {
2087
+ tag?: string;
2088
+ engine?: "go" | "apple";
2089
+ version?: 0 | 1 | 2 | 3;
2090
+ disable_version_fallback?: boolean;
2091
+ headers?: HTTPHeader$1;
2092
+ idle_timeout?: Duration$1;
2093
+ keep_alive_period?: Duration$1;
2094
+ stream_receive_window?: number | string;
2095
+ connection_receive_window?: number | string;
2096
+ max_concurrent_streams?: number;
2097
+ initial_packet_size?: number;
2098
+ disable_path_mtu_discovery?: boolean;
2099
+ }
2100
+ interface DNSServerDhcpOptions {
2101
+ tag: string;
2102
+ prefer_go?: boolean;
2103
+ neighbor_domain?: string | string[];
2104
+ interface?: string;
2105
+ }
2106
+ interface DNSServerFakeipOptions {
2107
+ tag: string;
2108
+ inet4_range?: string;
2109
+ inet6_range?: string;
2110
+ }
2111
+ interface DNSServerH3Options {
2112
+ tag: string;
2113
+ server?: string;
2114
+ server_port?: number;
2115
+ path?: string;
2116
+ method?: string;
2117
+ headers?: HTTPHeader$1;
2118
+ }
2119
+ interface DNSServerHostsOptions {
2120
+ tag: string;
2121
+ path?: string | string[];
2122
+ predefined?: {
2123
+ [k: string]: string | string[];
2124
+ };
2125
+ }
2126
+ interface DNSServerHttpsOptions {
2127
+ tag: string;
2128
+ server: string;
2129
+ server_port?: number;
2130
+ path?: string;
2131
+ method?: string;
2132
+ headers?: HTTPHeader$1;
2133
+ }
2134
+ interface DNSServerLocalOptions {
2135
+ tag: string;
2136
+ prefer_go?: boolean;
2137
+ neighbor_domain?: string | string[];
2138
+ }
2139
+ interface DNSServerMdnsOptions {
2140
+ tag: string;
2141
+ prefer_go?: boolean;
2142
+ neighbor_domain?: string | string[];
2143
+ interface?: string | string[];
2144
+ }
2145
+ interface DNSServerOpenconnectOptions {
2146
+ tag: string;
2147
+ endpoint: OpenConnectEndpoint;
2148
+ accept_default_resolvers?: boolean;
2149
+ accept_search_domain?: boolean;
2150
+ }
2151
+ interface DNSServerOpenvpnOptions {
2152
+ tag: string;
2153
+ endpoint: OpenVpnClientEndpoint;
2154
+ accept_default_resolvers?: boolean;
2155
+ accept_search_domain?: boolean;
2156
+ }
2157
+ interface DNSServerQuicOptions {
2158
+ tag: string;
2159
+ server?: string;
2160
+ server_port?: number;
2161
+ }
2162
+ interface DNSServerResolvedOptions {
2163
+ tag: string;
2164
+ service: ResolvedService;
2165
+ accept_default_resolvers?: boolean;
2166
+ }
2167
+ interface DNSServerTailscaleOptions {
2168
+ tag: string;
2169
+ endpoint: TailscaleEndpoint;
2170
+ accept_default_resolvers?: boolean;
2171
+ accept_search_domain?: boolean;
2172
+ }
2173
+ interface DNSServerTcpOptions {
2174
+ tag: string;
2175
+ server: string;
2176
+ server_port?: number;
2177
+ }
2178
+ interface RuleSetInlineOptions {
2179
+ tag: string | string[];
2180
+ rules: HeadlessRule$1[];
2181
+ }
2182
+ interface RuleSetLocalOptions {
2183
+ tag: string | string[];
2184
+ format?: "source" | "binary";
2185
+ path: string;
2186
+ }
2187
+ interface RuleSetRemoteOptions {
2188
+ tag: string | string[];
2189
+ format?: "source" | "binary";
2190
+ url: string;
2191
+ initial_path?: string;
2192
+ http_client?: HTTPClientReference$1;
2193
+ update_interval?: Duration$1;
2194
+ }
2195
+ interface CertificateProviderAcmeOptions {
2196
+ tag: string;
2197
+ domain?: string | string[];
2198
+ data_directory?: string;
2199
+ default_server_name?: string;
2200
+ email?: string;
2201
+ provider?: string;
2202
+ account_key?: string;
2203
+ disable_http_challenge?: boolean;
2204
+ disable_tls_alpn_challenge?: boolean;
2205
+ alternative_http_port?: number;
2206
+ alternative_tls_port?: number;
2207
+ external_account?: ACMEExternalAccountOptions$1;
2208
+ dns01_challenge?: ACMEProviderDNS01Challenge$1;
2209
+ key_type?: "ed25519" | "p256" | "p384" | "rsa2048" | "rsa4096";
2210
+ profile?: string;
2211
+ http_client?: HTTPClientReference$1;
2212
+ }
2213
+ interface CertificateProviderCloudflareOriginCaOptions {
2214
+ tag: string;
2215
+ domain?: string | string[];
2216
+ data_directory?: string;
2217
+ api_token?: string;
2218
+ origin_ca_key?: string;
2219
+ request_type?: "origin-rsa" | "origin-ecc";
2220
+ requested_validity?: 0 | 7 | 30 | 90 | 365 | 730 | 1095 | 5475;
2221
+ http_client?: HTTPClientReference$1;
2222
+ }
2223
+ interface CertificateProviderTailscaleOptions {
2224
+ tag: string;
2225
+ endpoint: TailscaleEndpoint;
2226
+ }
2227
+ interface NetworkNamespaceDefaultOptions {
2228
+ tag: string;
2229
+ path: string;
2230
+ }
2231
+ interface NetworkNamespaceUnshareOptions {
2232
+ tag: string;
2233
+ pid_file?: string;
2234
+ }
2235
+ interface LogOptions$1 {
2236
+ disabled?: boolean;
2237
+ level?: "trace" | "debug" | "info" | "warn" | "warning" | "error" | "fatal" | "panic";
2238
+ output?: string;
2239
+ timestamp?: boolean;
2240
+ }
2241
+ interface NTPOptions$1 {
2242
+ enabled?: boolean;
2243
+ interval?: Duration$1;
2244
+ write_to_system?: boolean;
2245
+ server?: string;
2246
+ server_port?: number;
2247
+ detour?: Egress;
2248
+ bind_interface?: string;
2249
+ inet4_bind_address?: string;
2250
+ inet6_bind_address?: string;
2251
+ bind_address_no_port?: boolean;
2252
+ protect_path?: string;
2253
+ routing_mark?: number | string;
2254
+ reuse_addr?: boolean;
2255
+ netns?: Namespace | string;
2256
+ connect_timeout?: Duration$1;
2257
+ tcp_fast_open?: boolean;
2258
+ tcp_multi_path?: boolean;
2259
+ disable_tcp_keep_alive?: boolean;
2260
+ tcp_keep_alive?: Duration$1;
2261
+ tcp_keep_alive_interval?: Duration$1;
2262
+ udp_fragment?: boolean;
2263
+ domain_resolver?: DomainResolver$2;
2264
+ network_strategy?: "default" | "fallback" | "hybrid";
2265
+ network_type?: InterfaceType$1 | InterfaceType$1[];
2266
+ fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
2267
+ fallback_delay?: Duration$1;
2268
+ }
2269
+ interface ExperimentalOptions$1 {
2270
+ cache_file?: CacheFileOptions$1;
2271
+ clash_api?: ClashAPIOptions$1;
2272
+ v2ray_api?: V2RayAPIOptions$1;
2273
+ debug?: DebugOptions$1;
2274
+ }
2275
+ interface CacheFileOptions$1 {
2276
+ enabled?: boolean;
2277
+ path?: string;
2278
+ cache_id?: string;
2279
+ store_fakeip?: boolean;
2280
+ rdrc_timeout?: Duration$1;
2281
+ store_dns?: boolean;
2282
+ }
2283
+ interface ClashAPIOptions$1 {
2284
+ external_controller?: string;
2285
+ external_ui?: string;
2286
+ external_ui_download_url?: string;
2287
+ external_ui_download_detour?: Egress;
2288
+ secret?: string;
2289
+ default_mode?: string;
2290
+ access_control_allow_origin?: string | string[];
2291
+ access_control_allow_private_network?: boolean;
2292
+ }
2293
+ interface V2RayAPIOptions$1 {
2294
+ listen?: string;
2295
+ stats?: V2RayStatsServiceOptions$1;
2296
+ }
2297
+ interface V2RayStatsServiceOptions$1 {
2298
+ enabled?: boolean;
2299
+ inbounds?: string[];
2300
+ outbounds?: string[];
2301
+ users?: string[];
2302
+ }
2303
+ interface DebugOptions$1 {
2304
+ listen?: string;
2305
+ gc_percent?: number;
2306
+ max_stack?: number;
2307
+ max_threads?: number;
2308
+ panic_on_fault?: boolean;
2309
+ trace_back?: string;
2310
+ memory_limit?: number | string;
2311
+ oom_killer?: boolean;
2312
+ }
2313
+ interface RouteSettings {
2314
+ final?: Egress;
2315
+ find_process?: boolean;
2316
+ find_neighbor?: boolean;
2317
+ dhcp_lease_files?: string | string[];
2318
+ auto_detect_interface?: boolean;
2319
+ override_android_vpn?: boolean;
2320
+ default_interface?: string;
2321
+ default_mark?: number | string;
2322
+ default_domain_resolver?: DomainResolver$2;
2323
+ default_network_strategy?: "default" | "fallback" | "hybrid";
2324
+ default_network_type?: InterfaceType$1 | InterfaceType$1[];
2325
+ default_fallback_network_type?: InterfaceType$1 | InterfaceType$1[];
2326
+ default_fallback_delay?: Duration$1;
2327
+ default_http_client?: TaggedHttpClient;
2328
+ }
2329
+ interface DnsSettings {
2330
+ final?: DnsServer;
2331
+ reverse_mapping?: boolean;
2332
+ strategy?: DomainStrategy$1;
2333
+ timeout?: Duration$1;
2334
+ disable_cache?: boolean;
2335
+ disable_expire?: boolean;
2336
+ cache_capacity?: number;
2337
+ optimistic?: boolean | {
2338
+ enabled?: boolean;
2339
+ timeout?: Duration$1;
2340
+ };
2341
+ client_subnet?: string;
2342
+ }
2343
+ interface RouteMatchFields {
2344
+ inbound?: InboundRef | InboundRef[];
2345
+ ip_version?: 4 | 6;
2346
+ network?: ("tcp" | "udp" | "icmp") | ("tcp" | "udp" | "icmp")[];
2347
+ auth_user?: string | string[];
2348
+ protocol?: ("tls" | "http" | "quic" | "dns" | "stun" | "bittorrent" | "dtls" | "ssh" | "rdp" | "ntp") | ("tls" | "http" | "quic" | "dns" | "stun" | "bittorrent" | "dtls" | "ssh" | "rdp" | "ntp")[];
2349
+ client?: string | string[];
2350
+ domain?: string | string[];
2351
+ domain_suffix?: string | string[];
2352
+ domain_keyword?: string | string[];
2353
+ domain_regex?: string | string[];
2354
+ source_ip_cidr?: string | string[];
2355
+ source_ip_is_private?: boolean;
2356
+ ip_cidr?: string | string[];
2357
+ ip_is_private?: boolean;
2358
+ source_port?: number | number[];
2359
+ source_port_range?: string | string[];
2360
+ port?: number | number[];
2361
+ port_range?: string | string[];
2362
+ process_name?: string | string[];
2363
+ process_path?: string | string[];
2364
+ process_path_regex?: string | string[];
2365
+ package_name?: string | string[];
2366
+ package_name_regex?: string | string[];
2367
+ user?: string | string[];
2368
+ user_id?: number | number[];
2369
+ clash_mode?: string;
2370
+ network_type?: InterfaceType$1 | InterfaceType$1[];
2371
+ network_is_expensive?: boolean;
2372
+ network_is_constrained?: boolean;
2373
+ wifi_ssid?: string | string[];
2374
+ wifi_bssid?: string | string[];
2375
+ interface_address?: {
2376
+ [k: string]: string | string[];
2377
+ };
2378
+ network_interface_address?: {
2379
+ cellular?: string | string[];
2380
+ ethernet?: string | string[];
2381
+ other?: string | string[];
2382
+ wifi?: string | string[];
2383
+ };
2384
+ default_interface_address?: string | string[];
2385
+ source_mac_address?: string | string[];
2386
+ source_hostname?: string | string[];
2387
+ preferred_by?: PreferredRoutes | PreferredRoutes[];
2388
+ rule_set?: RuleSetRef | RuleSetRef[];
2389
+ rule_set_ip_cidr_match_source?: boolean;
2390
+ invert?: boolean;
2391
+ }
2392
+ interface DnsMatchFields {
2393
+ inbound?: InboundRef | InboundRef[];
2394
+ ip_version?: 4 | 6;
2395
+ query_type?: DNSQueryType$1 | DNSQueryType$1[];
2396
+ query_client_subnet?: string | string[];
2397
+ query_dnssec?: boolean;
2398
+ network?: ("tcp" | "udp") | ("tcp" | "udp")[];
2399
+ auth_user?: string | string[];
2400
+ protocol?: ("tls" | "http" | "quic" | "dns" | "stun" | "bittorrent" | "dtls" | "ssh" | "rdp" | "ntp") | ("tls" | "http" | "quic" | "dns" | "stun" | "bittorrent" | "dtls" | "ssh" | "rdp" | "ntp")[];
2401
+ domain?: string | string[];
2402
+ domain_suffix?: string | string[];
2403
+ domain_keyword?: string | string[];
2404
+ domain_regex?: string | string[];
2405
+ source_ip_cidr?: string | string[];
2406
+ source_ip_is_private?: boolean;
2407
+ source_port?: number | number[];
2408
+ source_port_range?: string | string[];
2409
+ port?: number | number[];
2410
+ port_range?: string | string[];
2411
+ process_name?: string | string[];
2412
+ process_path?: string | string[];
2413
+ process_path_regex?: string | string[];
2414
+ package_name?: string | string[];
2415
+ package_name_regex?: string | string[];
2416
+ user?: string | string[];
2417
+ user_id?: number | number[];
2418
+ clash_mode?: string;
2419
+ network_type?: InterfaceType$1 | InterfaceType$1[];
2420
+ network_is_expensive?: boolean;
2421
+ network_is_constrained?: boolean;
2422
+ wifi_ssid?: string | string[];
2423
+ wifi_bssid?: string | string[];
2424
+ interface_address?: {
2425
+ [k: string]: string | string[];
2426
+ };
2427
+ network_interface_address?: {
2428
+ cellular?: string | string[];
2429
+ ethernet?: string | string[];
2430
+ other?: string | string[];
2431
+ wifi?: string | string[];
2432
+ };
2433
+ default_interface_address?: string | string[];
2434
+ source_mac_address?: string | string[];
2435
+ source_hostname?: string | string[];
2436
+ preferred_by?: PreferredDomain | PreferredDomain[];
2437
+ rule_set?: RuleSetRef | RuleSetRef[];
2438
+ rule_set_ip_cidr_match_source?: boolean;
2439
+ match_response?: boolean | string;
2440
+ ip_cidr?: string | string[];
2441
+ ip_is_private?: boolean;
2442
+ ip_accept_any?: boolean;
2443
+ response_rcode?: DNSRCode$1;
2444
+ response_answer?: string | string[];
2445
+ response_ns?: string | string[];
2446
+ response_extra?: string | string[];
2447
+ invert?: boolean;
2448
+ }
2
2449
  /**
3
2450
  * This file was automatically generated by json-schema-to-typescript.
4
2451
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -468,7 +2915,7 @@ type NestedDNSRule = {
468
2915
  rules: NestedDNSRule[];
469
2916
  invert?: boolean;
470
2917
  };
471
- type CertificateProvider$1 = {
2918
+ type CertificateProvider = {
472
2919
  type: "acme";
473
2920
  tag?: string;
474
2921
  domain?: string | string[];
@@ -867,7 +3314,7 @@ type Endpoint = {
867
3314
  fallback_delay?: Duration;
868
3315
  };
869
3316
  type UDPTimeout = number | string;
870
- type Inbound = {
3317
+ type Inbound$1 = {
871
3318
  type: "anytls";
872
3319
  tag?: string;
873
3320
  listen?: string;
@@ -1415,7 +3862,7 @@ type V2RayTransport = {
1415
3862
  path?: string;
1416
3863
  headers?: HTTPHeader;
1417
3864
  };
1418
- type Outbound = {
3865
+ type Outbound$1 = {
1419
3866
  type: "anytls";
1420
3867
  tag?: string;
1421
3868
  detour?: string;
@@ -2591,12 +5038,12 @@ interface SingBoxConfig {
2591
5038
  certificate_path?: string | string[];
2592
5039
  certificate_directory_path?: string | string[];
2593
5040
  };
2594
- certificate_providers?: CertificateProvider$1[];
5041
+ certificate_providers?: CertificateProvider[];
2595
5042
  http_clients?: HTTPClient[];
2596
5043
  network_namespaces?: NetworkNamespace[];
2597
5044
  endpoints?: Endpoint[];
2598
- inbounds?: Inbound[];
2599
- outbounds?: Outbound[];
5045
+ inbounds?: Inbound$1[];
5046
+ outbounds?: Outbound$1[];
2600
5047
  route?: RouteOptions;
2601
5048
  services?: Service[];
2602
5049
  experimental?: ExperimentalOptions;
@@ -3223,64 +5670,23 @@ interface DebugOptions {
3223
5670
  memory_limit?: number | string;
3224
5671
  oom_killer?: boolean;
3225
5672
  }
3226
- type Fields = Record<string, unknown>;
3227
- type ReadonlyJson<T> = T extends object ? { readonly [K in keyof T]: ReadonlyJson<T[K]>; } : T;
3228
- type Target = "inbounds" | "outbounds" | "endpoints" | "services" | "http_clients" | "dns.servers" | "route.rule_set" | "certificate_providers" | "network_namespaces";
3229
- type Role = "inbound" | "listen-detour" | "dial-detour" | "egress" | "preferred-routes" | "dns-server" | "preferred-domain" | "ssm" | "certificate-provider" | "http-client" | "netns" | "rule-set" | "tailscale-endpoint";
3230
- declare const resourceBrand: unique symbol;
3231
- interface Resource<T extends Target = Target, K extends string = string, Tag extends string | readonly string[] | undefined = string | readonly string[] | undefined, R extends Role = Role> {
3232
- readonly [resourceBrand]: {
3233
- target: T;
3234
- kind: K;
3235
- tag: Tag;
3236
- roles: R;
3237
- };
3238
- }
3239
- type InboundRef = Resource<"inbounds" | "endpoints", string, string>;
3240
- type ListenDetour = Resource<"inbounds", string, string, "listen-detour" | "inbound" | "ssm">;
3241
- type Egress = Resource<"outbounds" | "endpoints", string, string>;
3242
- type PreferredRoutes = Resource<"endpoints", "tailscale" | "wireguard", string>;
3243
- type DnsServer = Resource<"dns.servers", string, string>;
3244
- type PreferredDomain = Resource<"dns.servers", "tailscale", string>;
3245
- type Namespace = Resource<"network_namespaces", string, string>;
3246
- type CertificateProvider = Resource<"certificate_providers", string, string>;
3247
- type TaggedHttpClient = Resource<"http_clients", "http-client", string>;
3248
- type RuleSetRef = Resource<"route.rule_set", string, string | readonly [string]>;
3249
- type SsmInbound = Resource<"inbounds", "shadowsocks", string, "inbound" | "listen-detour" | "ssm"> & {
3250
- readonly [ssmBrand]: true;
3251
- };
3252
- declare const ssmBrand: unique symbol;
3253
- type TailscaleEndpoint = Resource<"endpoints", "tailscale", string>;
3254
- type Resolve = (value: unknown, role: Role, path: string) => string;
3255
- type Expand = (value: unknown, path: string, resolve: Resolve) => unknown;
3256
- type Expansions = Readonly<Record<string, Expand>>;
3257
5673
  type Scope = "route" | "dns";
3258
- type OneOrMany<T> = T | readonly T[];
3259
- type RouteLeaf = Exclude<NestedRule, {
3260
- type: "logical";
3261
- }>;
3262
- type DnsLeaf = Exclude<NestedDNSRule, {
3263
- type: "logical";
3264
- }>;
3265
- declare const commonMatches: readonly ["domain", "domain_suffix", "port", "auth_user"];
3266
- declare const routeMatches: readonly ["client"];
3267
- declare const dnsMatches: readonly ["query_type", "match_response", "response_rcode", "response_answer", "response_ns", "response_extra", "ip_cidr", "ip_is_private", "ip_accept_any"];
3268
- type CommonMatches = ReadonlyJson<Pick<RouteLeaf, Exclude<(typeof commonMatches)[number], "auth_user">>> & {
3269
- /** An empty string can match traffic with no authenticated name. */
3270
- readonly auth_user?: OneOrMany<string>;
3271
- readonly inbound?: OneOrMany<InboundRef>;
3272
- readonly rule_set?: OneOrMany<RuleSetRef>;
3273
- };
3274
- type RouteMatches = ReadonlyJson<Pick<RouteLeaf, (typeof routeMatches)[number]>> & {
3275
- readonly preferred_by?: OneOrMany<PreferredRoutes>;
3276
- };
3277
- type DnsMatches = ReadonlyJson<Pick<DnsLeaf, (typeof dnsMatches)[number]>> & {
3278
- readonly preferred_by?: OneOrMany<PreferredDomain>;
3279
- };
3280
- type RouteMatchInput = CommonMatches & RouteMatches & { readonly [K in (typeof dnsMatches)[number]]?: never; };
3281
- type DnsMatchInput = CommonMatches & DnsMatches & { readonly [K in (typeof routeMatches)[number]]?: never; };
3282
- type MatchFields = RouteMatchInput | DnsMatchInput;
3283
- type MatchScope<M> = ([M] extends [RouteMatchInput] ? "route" : never) | ([M] extends [DnsMatchInput] ? "dns" : never);
5674
+ type RouteMatch = ReadonlyJson<SBKitInputs["matches"]["route"]>;
5675
+ type DnsMatch = ReadonlyJson<SBKitInputs["matches"]["dns"]>;
5676
+ declare const responseMatches: readonly ["response_rcode", "response_answer", "response_ns", "response_extra", "ip_cidr", "ip_is_private", "ip_accept_any"];
5677
+ type ResponseKey = (typeof responseMatches)[number];
5678
+ type DnsMatchInput = Omit<DnsMatch, ResponseKey | "match_response"> & ((Pick<DnsMatch, ResponseKey> & {
5679
+ readonly match_response: true | string;
5680
+ }) | {
5681
+ readonly match_response?: false;
5682
+ readonly ip_is_private?: false;
5683
+ readonly ip_accept_any?: false;
5684
+ });
5685
+ type AllMatchKeys = keyof RouteMatch | keyof DnsMatch;
5686
+ type RouteMatchInput = RouteMatch & { readonly [K in Exclude<AllMatchKeys, keyof RouteMatch>]?: never; };
5687
+ type ScopedDnsMatch = DnsMatchInput & { readonly [K in Exclude<AllMatchKeys, keyof DnsMatch>]?: never; };
5688
+ type MatchFields = RouteMatchInput | ScopedDnsMatch;
5689
+ type MatchScope<M> = ([M] extends [RouteMatchInput] ? "route" : never) | ([M] extends [ScopedDnsMatch] ? "dns" : never);
3284
5690
  declare const conditionBrand: unique symbol;
3285
5691
  interface Condition<S extends Scope = Scope> {
3286
5692
  readonly [conditionBrand]: S;
@@ -3288,49 +5694,12 @@ interface Condition<S extends Scope = Scope> {
3288
5694
  or<O extends Scope>(other: Condition<O> & ([S & O] extends [never] ? never : unknown)): Condition<S & O>;
3289
5695
  not(): Condition<S>;
3290
5696
  }
3291
- declare function match<M extends MatchFields>(input: M & Record<Exclude<keyof M, keyof MatchFields>, never>): Condition<MatchScope<M>>;
5697
+ declare function match<const M extends MatchFields>(input: M & Record<Exclude<keyof M, AllMatchKeys>, never>): Condition<MatchScope<M>>;
3292
5698
  export declare const Rule: Readonly<{
3293
5699
  match: typeof match;
3294
5700
  }>;
3295
- type SharedDnsOptions = ReadonlyJson<Pick<Extract<DNSRuleAction, {
3296
- action: "route-options";
3297
- }>, "timeout" | "disable_cache" | "disable_optimistic_cache" | "rewrite_ttl" | "client_subnet" | "remove_client_subnet">>;
3298
- type RejectOptions = Omit<Extract<RuleAction$1, {
3299
- action: "reject";
3300
- }>, "action" | "method"> & {
3301
- method?: "default" | "drop";
3302
- };
3303
- type RouteRuleAction = {
3304
- action: "route";
3305
- outbound: Egress;
3306
- } | {
3307
- action: "bypass";
3308
- outbound?: Egress;
3309
- } | ({
3310
- action: "reject";
3311
- } & RejectOptions) | {
3312
- action: "hijack-dns";
3313
- };
3314
- type DnsRuleAction = ({
3315
- action: "route";
3316
- server: DnsServer;
3317
- speculative?: boolean;
3318
- race?: boolean;
3319
- } & SharedDnsOptions) | ({
3320
- action: "evaluate";
3321
- server: DnsServer;
3322
- tag?: string;
3323
- speculative?: boolean;
3324
- } & SharedDnsOptions) | Extract<DNSRuleAction, {
3325
- action: "respond";
3326
- }> | ({
3327
- action: "route-options";
3328
- } & SharedDnsOptions) | ({
3329
- action: "reject";
3330
- race?: boolean;
3331
- } & RejectOptions) | ReadonlyJson<Extract<DNSRuleAction, {
3332
- action: "predefined";
3333
- }>>;
5701
+ type RouteRuleAction = StrictUnion<ReadonlyJson<SBKitInputs["actions"]["route"]>>;
5702
+ type DnsRuleAction = StrictUnion<ReadonlyJson<SBKitInputs["actions"]["dns"]>>;
3334
5703
  type RuleAction<S extends Scope> = {
3335
5704
  route: RouteRuleAction;
3336
5705
  dns: DnsRuleAction;
@@ -3349,43 +5718,48 @@ export declare const route: Readonly<{
3349
5718
  export declare const dns: Readonly<{
3350
5719
  rule: RuleFactory<"dns">;
3351
5720
  }>;
3352
- type DomainResolver = DnsServer | (ReadonlyJson<Omit<Extract<DomainResolver$1, object>, "server">> & {
3353
- readonly server: DnsServer;
3354
- });
3355
- interface DirectDial {
3356
- /**
3357
- * Go Duration string. An explicit detour disallows a non-zero timeout on
3358
- * the resource using it. Configure the timeout on the detour target.
3359
- * On a direct detour target, an effective zero is equivalent to omission.
3360
- */
3361
- readonly connect_timeout?: HTTPClient["connect_timeout"];
3362
- readonly domain_resolver?: DomainResolver;
3363
- readonly netns?: Namespace | string;
3364
- }
3365
- interface Dial extends DirectDial {
3366
- readonly detour?: Egress;
3367
- }
3368
- interface Listener {
3369
- readonly port: number;
3370
- readonly netns?: Namespace | string;
3371
- }
3372
- interface InboundListener extends Listener {
3373
- readonly detour?: ListenDetour;
5721
+ interface CompileInput extends Partial<ReadonlyJson<SBKitInputs["root"]>> {
5722
+ readonly inbounds?: readonly Resource<"inbounds">[];
5723
+ readonly outbounds?: readonly Resource<"outbounds">[];
5724
+ readonly endpoints?: readonly Resource<"endpoints">[];
5725
+ readonly services?: readonly Resource<"services">[];
5726
+ readonly http_clients?: readonly TaggedHttpClient[];
5727
+ readonly certificate_providers?: readonly Resource<"certificate_providers">[];
5728
+ readonly network_namespaces?: readonly Resource<"network_namespaces">[];
5729
+ readonly route?: {
5730
+ readonly rules?: readonly RuleValue<"route">[];
5731
+ readonly rule_set?: readonly Resource<"route.rule_set">[];
5732
+ } & ReadonlyJson<SBKitInputs["sections"]["route"]>;
5733
+ readonly dns?: {
5734
+ readonly rules?: readonly RuleValue<"dns">[];
5735
+ readonly servers?: readonly DnsServer[];
5736
+ } & ReadonlyJson<SBKitInputs["sections"]["dns"]>;
3374
5737
  }
5738
+ /**
5739
+ * Compile using registered final values. If you recreate a resource with the
5740
+ * same tag, rebuild its references so they refer to the new value.
5741
+ */
5742
+ export declare function compile(input: CompileInput): SingBoxConfig;
5743
+ export declare function validateConfig(value: unknown): SingBoxConfig;
5744
+ type DomainResolver = ReadonlyJson<DomainResolver$2>;
5745
+ type DirectDial = ReadonlyJson<SBKitInputs["factories"]["outbounds"]["direct"]["dial"]>;
5746
+ type Dial = ReadonlyJson<SBKitInputs["factories"]["outbounds"]["vless"]["dial"]>;
5747
+ type InboundListener = ReadonlyJson<SBKitInputs["factories"]["inbounds"]["mixed"]["listen"]>;
5748
+ type Listener = Omit<InboundListener, "detour">;
3375
5749
  type ServerTls = {
3376
5750
  side: "server";
3377
5751
  reality?: never;
3378
- } & ((Required<Pick<InboundTLSOptions, "certificate_path" | "key_path">> & {
5752
+ } & ((Required<Pick<InboundTLSOptions$1, "certificate_path" | "key_path">> & {
3379
5753
  certificate_provider?: never;
3380
5754
  }) | {
3381
- certificate_provider: CertificateProvider;
5755
+ certificate_provider: CertificateProvider$1;
3382
5756
  certificate_path?: never;
3383
5757
  key_path?: never;
3384
5758
  });
3385
5759
  type ClientTls = {
3386
5760
  side: "client";
3387
5761
  reality?: never;
3388
- } & ReadonlyJson<Pick<OutboundTLSOptions, "server_name" | "certificate_path">>;
5762
+ } & ReadonlyJson<Pick<OutboundTLSOptions$1, "server_name" | "certificate_path">>;
3389
5763
  type RealityServerTls = {
3390
5764
  side: "server";
3391
5765
  server_name: string;
@@ -3395,7 +5769,10 @@ type RealityServerTls = {
3395
5769
  reality: {
3396
5770
  private_key: string;
3397
5771
  short_id: string | readonly string[];
3398
- handshake: Required<Pick<InboundRealityHandshakeOptions, "server" | "server_port">> & Dial;
5772
+ handshake: {
5773
+ server: string;
5774
+ server_port: number;
5775
+ } & Dial;
3399
5776
  };
3400
5777
  };
3401
5778
  type RealityClientTls = {
@@ -3407,50 +5784,58 @@ type RealityClientTls = {
3407
5784
  short_id: string;
3408
5785
  };
3409
5786
  };
3410
- type HttpClientValue = Resource<"http_clients", "http-client", string | undefined>;
3411
- type InlineHttpClient = ReadonlyJson<Omit<Extract<HTTPClientReference, object>, keyof Dial>> & Dial & {
5787
+ type InlineHttpClient = ReadonlyJson<Exclude<HTTPClientReference$1, HttpClientValue>> & {
3412
5788
  readonly tag?: never;
3413
5789
  };
3414
- type HttpClientInput = HttpClientValue | InlineHttpClient;
3415
- type TlsMode = "server" | "client" | "server-reality" | "client-reality";
3416
- interface CompileInput {
3417
- readonly log?: ReadonlyJson<NonNullable<SingBoxConfig["log"]>>;
3418
- readonly experimental?: ReadonlyJson<NonNullable<SingBoxConfig["experimental"]>>;
3419
- readonly inbounds?: readonly Resource<"inbounds">[];
3420
- readonly outbounds?: readonly Resource<"outbounds">[];
3421
- readonly endpoints?: readonly Resource<"endpoints">[];
3422
- readonly services?: readonly Resource<"services">[];
3423
- readonly http_clients?: readonly TaggedHttpClient[];
3424
- readonly certificate_providers?: readonly Resource<"certificate_providers">[];
3425
- readonly network_namespaces?: readonly Resource<"network_namespaces">[];
3426
- readonly route?: {
3427
- readonly rules?: readonly RuleValue<"route">[];
3428
- readonly rule_set?: readonly Resource<"route.rule_set">[];
3429
- readonly final?: Egress;
3430
- readonly default_domain_resolver?: DomainResolver;
3431
- readonly default_http_client?: TaggedHttpClient;
3432
- };
3433
- readonly dns?: {
3434
- readonly rules?: readonly RuleValue<"dns">[];
3435
- readonly servers?: readonly DnsServer[];
3436
- readonly final?: DnsServer;
3437
- };
3438
- }
3439
- /**
3440
- * Compile using registered final values. If you recreate a resource with the
3441
- * same tag, rebuild its references so they refer to the new value.
3442
- */
3443
- export declare function compile(input: CompileInput): SingBoxConfig;
5790
+ type HttpClientInput = ReadonlyJson<HTTPClientReference$1>;
5791
+ type ProtocolTlsOptions<K, T> = T & (K extends "naive" ? {
5792
+ readonly alpn?: never;
5793
+ } : unknown);
3444
5794
  declare const userBrand: unique symbol;
3445
5795
  interface User {
3446
5796
  readonly name: string;
3447
5797
  readonly [userBrand]: true;
3448
5798
  }
5799
+ type Password = {
5800
+ readonly password: string;
5801
+ };
5802
+ interface UserCredentials {
5803
+ readonly anytls?: Password;
5804
+ readonly http?: Password;
5805
+ readonly hysteria?: StrictUnion<{
5806
+ readonly auth: string | readonly number[];
5807
+ } | {
5808
+ readonly auth_str: string;
5809
+ }>;
5810
+ readonly hysteria2?: Password;
5811
+ readonly mixed?: Password;
5812
+ readonly naive?: Password;
5813
+ readonly shadowsocks?: Password;
5814
+ readonly shadowtls?: Password;
5815
+ readonly snell?: {
5816
+ readonly userkey: string;
5817
+ };
5818
+ readonly socks?: Password;
5819
+ readonly trojan?: Password;
5820
+ readonly tuic?: Password & {
5821
+ readonly uuid: string;
5822
+ };
5823
+ readonly vless?: {
5824
+ readonly uuid: string;
5825
+ readonly flow?: string;
5826
+ };
5827
+ readonly vmess?: {
5828
+ readonly uuid: string;
5829
+ readonly alter_id?: number;
5830
+ };
5831
+ }
3449
5832
  export declare function user(input: {
3450
5833
  name: string;
5834
+ credentials?: UserCredentials;
3451
5835
  }): User;
3452
5836
  interface ListenMethod<T> {
3453
- listen(address: string, options: T): this;
5837
+ listen(options?: T): this;
5838
+ listen(address?: "port" extends keyof T ? string : undefined, options?: T): this;
3454
5839
  }
3455
5840
  interface DialMethod<T> {
3456
5841
  dial(options: T): this;
@@ -3472,142 +5857,113 @@ declare const targetRoles: {
3472
5857
  readonly certificate_providers: readonly ["certificate-provider"];
3473
5858
  readonly network_namespaces: readonly ["netns"];
3474
5859
  };
3475
- type PasswordEntry<Name extends "username" | "name"> = {
3476
- readonly user: User;
3477
- readonly password: string;
3478
- } & { readonly [K in Name]?: never; };
3479
- type MixedEntry = PasswordEntry<"username"> | (Readonly<User$1> & {
3480
- user?: never;
3481
- });
3482
- type ShadowsocksEntry = PasswordEntry<"name"> | (Readonly<ShadowsocksUser> & {
3483
- user?: never;
3484
- });
3485
- type VlessEntry = Required<Pick<VLESSUser, "uuid">> & Pick<VLESSUser, "flow"> & {
3486
- user: User;
3487
- name?: never;
3488
- };
3489
- interface AuthOptions {
3490
- readonly name: "name" | "username";
3491
- readonly credentials: readonly string[];
3492
- readonly required: readonly string[];
3493
- readonly allowRaw?: boolean;
3494
- }
3495
- interface Definition {
3496
- readonly target: Target;
3497
- readonly kind: string;
3498
- readonly required: readonly string[];
3499
- readonly optional?: readonly string[];
3500
- readonly listen?: "listener" | "forwarding";
3501
- readonly dial?: "direct" | "detour";
3502
- readonly tls?: TlsMode;
3503
- readonly auth?: AuthOptions;
3504
- readonly roles?: readonly Role[];
3505
- readonly references?: Expansions;
3506
- readonly remoteDns?: boolean;
3507
- readonly startupDetour?: boolean;
3508
- readonly prepare?: (fields: Fields, path: string) => readonly Role[] | void;
3509
- readonly checkDial?: (fields: Fields, dial: Fields, path: string) => void;
3510
- }
3511
- type RawByTarget = {
3512
- inbounds: Inbound;
3513
- outbounds: Outbound;
3514
- endpoints: Endpoint;
3515
- services: Service;
3516
- http_clients: HTTPClient;
3517
- "dns.servers": DNSServer;
3518
- "route.rule_set": RuleSet;
3519
- certificate_providers: CertificateProvider$1;
3520
- network_namespaces: NetworkNamespace;
3521
- };
3522
- type Variant<Raw, Kind> = Raw extends {
3523
- type?: infer Type;
3524
- } ? Kind extends Type ? Raw : never : never;
3525
- type Raw<D extends Definition> = D["target"] extends "http_clients" ? HTTPClient : Variant<RawByTarget[D["target"]], D["kind"]>;
3526
- type Options<D extends Definition> = ReadonlyJson<Required<Pick<Raw<D>, Extract<D["required"][number], keyof Raw<D>>>> & Pick<Raw<D>, Extract<NonNullable<D["optional"]>[number], keyof Raw<D>>>>;
3527
- type Override<T, U> = Omit<T, keyof U> & U;
3528
- type TlsProfile = {
3529
- server: ServerTls;
3530
- client: ClientTls;
3531
- "server-reality": ServerTls | RealityServerTls;
3532
- "client-reality": ClientTls | RealityClientTls;
5860
+ declare const endpointRoles: {
5861
+ readonly tailscale: "tailscale-endpoint";
5862
+ readonly openconnect: "openconnect-endpoint";
5863
+ readonly "openvpn-client": "openvpn-client-endpoint";
3533
5864
  };
3534
- type Tag = string | readonly string[] | undefined;
3535
- type ExtraRoles<D> = D extends {
3536
- roles: readonly (infer R extends Role)[];
3537
- } ? R : never;
3538
- type Built<D extends Definition, T extends Tag = string> = Resource<D["target"], D["kind"], T, (typeof targetRoles)[D["target"]][number] | ExtraRoles<D>> & (D extends {
3539
- listen: infer L;
3540
- } ? ListenMethod<L extends "forwarding" ? InboundListener : Listener> : unknown) & (D extends {
3541
- dial: infer F;
3542
- } ? DialMethod<F extends "direct" ? DirectDial : Dial> : unknown) & (D extends {
3543
- tls: infer P extends TlsMode;
3544
- } ? TlsMethod<TlsProfile[P]> : unknown) & (D extends {
3545
- auth: AuthOptions;
3546
- } ? AuthMethod : unknown);
3547
- declare const mixed: {
3548
- readonly target: "inbounds";
3549
- readonly kind: "mixed";
3550
- readonly required: readonly ["tag"];
3551
- readonly optional: readonly ["users", "set_system_proxy"];
3552
- readonly listen: "forwarding";
3553
- readonly tls: "server";
3554
- readonly auth: {
5865
+ declare const authOptions: {
5866
+ readonly anytls: {
5867
+ readonly name: "name";
5868
+ readonly allowRaw: true;
5869
+ };
5870
+ readonly http: {
3555
5871
  readonly name: "username";
3556
- readonly credentials: readonly ["password"];
3557
- readonly required: readonly ["password"];
3558
5872
  readonly allowRaw: true;
3559
5873
  };
3560
- };
3561
- declare const socks: {
3562
- readonly target: "inbounds";
3563
- readonly kind: "socks";
3564
- readonly required: readonly ["tag"];
3565
- readonly optional: readonly ["users"];
3566
- readonly listen: "forwarding";
3567
- readonly auth: {
5874
+ readonly hysteria: {
5875
+ readonly name: "name";
5876
+ readonly allowRaw: true;
5877
+ };
5878
+ readonly hysteria2: {
5879
+ readonly name: "name";
5880
+ readonly allowRaw: true;
5881
+ };
5882
+ readonly mixed: {
3568
5883
  readonly name: "username";
3569
- readonly credentials: readonly ["password"];
3570
- readonly required: readonly ["password"];
5884
+ readonly allowRaw: true;
3571
5885
  };
3572
- };
3573
- declare const inboundVless: {
3574
- readonly target: "inbounds";
3575
- readonly kind: "vless";
3576
- readonly required: readonly ["tag", "users"];
3577
- readonly listen: "forwarding";
3578
- readonly tls: "server-reality";
3579
- readonly auth: {
5886
+ readonly naive: {
5887
+ readonly name: "username";
5888
+ readonly allowRaw: true;
5889
+ };
5890
+ readonly shadowsocks: {
3580
5891
  readonly name: "name";
3581
- readonly credentials: readonly ["uuid", "flow"];
3582
- readonly required: readonly ["uuid"];
5892
+ readonly allowRaw: true;
3583
5893
  };
3584
- };
3585
- declare const shadowsocks: {
3586
- readonly target: "inbounds";
3587
- readonly kind: "shadowsocks";
3588
- readonly required: readonly ["tag", "method"];
3589
- readonly optional: readonly ["network", "password", "users", "managed"];
3590
- readonly listen: "forwarding";
3591
- readonly auth: {
3592
- readonly credentials: readonly ["password"];
3593
- readonly required: readonly ["password"];
5894
+ readonly shadowtls: {
5895
+ readonly name: "name";
5896
+ readonly allowRaw: true;
5897
+ };
5898
+ readonly snell: {
5899
+ readonly name: "name";
5900
+ readonly allowRaw: true;
5901
+ };
5902
+ readonly socks: {
5903
+ readonly name: "username";
5904
+ readonly allowRaw: false;
5905
+ };
5906
+ readonly trojan: {
5907
+ readonly name: "name";
5908
+ readonly allowRaw: true;
5909
+ };
5910
+ readonly tuic: {
5911
+ readonly name: "name";
5912
+ readonly allowRaw: true;
5913
+ };
5914
+ readonly vless: {
5915
+ readonly name: "name";
5916
+ readonly allowRaw: false;
5917
+ };
5918
+ readonly vmess: {
3594
5919
  readonly name: "name";
3595
5920
  readonly allowRaw: true;
3596
5921
  };
3597
- readonly prepare: (fields: Fields, path: string) => "ssm"[] | undefined;
3598
5922
  };
3599
- type ShadowsocksBase = Omit<Options<typeof shadowsocks>, "method" | "users" | "managed">;
3600
- type Method = NonNullable<Extract<Inbound, {
3601
- type: "shadowsocks";
3602
- }>["method"]>;
3603
- type MultiMethod = Exclude<Method, "none">;
5923
+ type AuthKind = keyof typeof authOptions;
5924
+ type ShadowsocksEntry = User | (Readonly<ShadowsocksUser> & {
5925
+ user?: never;
5926
+ });
5927
+ type Catalog$1 = SBKitInputs["factories"];
5928
+ type Kind<T extends Target> = keyof Catalog$1[T] & string;
5929
+ type Groups<T extends Target, K extends Kind<T>> = ReadonlyJson<Catalog$1[T][K]>;
5930
+ type StrictTransport<O> = O extends {
5931
+ readonly transport?: infer V;
5932
+ } ? O & {
5933
+ readonly transport?: StrictUnion<NonNullable<V>>;
5934
+ } : O;
5935
+ type Options$1<T extends Target, K extends Kind<T>> = Groups<T, K> extends {
5936
+ options: infer O;
5937
+ } ? StrictUnion<StrictTransport<O>> : never;
5938
+ type Tag = string | readonly string[] | undefined;
5939
+ type ExtraRoles<T extends Target, K> = T extends "endpoints" ? (K extends keyof typeof endpointRoles ? (typeof endpointRoles)[K] : never) | (K extends (typeof preferredRouteEndpoints)[number] ? "preferred-routes" : never) : T extends "outbounds" ? K extends "bridge" ? "preferred-routes" : never : T extends "services" ? K extends "resolved" ? "resolved-service" : never : T extends "dns.servers" ? K extends (typeof preferredDnsKinds)[number] ? "preferred-domain" : never : never;
5940
+ type Profile$1<T extends Target, K, F> = "enabled" extends keyof F ? T extends "inbounds" | "services" ? ServerTls | (K extends "vless" ? RealityServerTls : never) : ClientTls | (K extends "vless" ? RealityClientTls : never) : never;
5941
+ type Built<T extends Target, K extends Kind<T>, V extends Tag = string, G = Groups<T, K>> = Resource<T, K, V, (typeof targetRoles)[T][number] | ExtraRoles<T, K>> & (G extends {
5942
+ listen: infer L;
5943
+ } ? ListenMethod<L> : unknown) & (G extends {
5944
+ dial: infer D;
5945
+ } ? DialMethod<D> : unknown) & (G extends {
5946
+ tls: infer F;
5947
+ } ? TlsMethod<ProtocolTlsOptions<K, (F & {
5948
+ side?: never;
5949
+ }) | Profile$1<T, K, F>>> : unknown) & (T extends "inbounds" ? (K extends keyof typeof authOptions ? AuthMethod : unknown) : unknown);
5950
+ type Factory<T extends Target, K extends Kind<T>> = T extends "services" | "http_clients" ? {
5951
+ (options: Options$1<T, K> & {
5952
+ tag: string;
5953
+ }): Built<T, K>;
5954
+ (...args: {} extends Options$1<T, K> ? [options?: Options$1<T, K>] : [options: Options$1<T, K>]): Built<T, K, string | undefined>;
5955
+ } : (options: Options$1<T, K>) => Built<T, K>;
5956
+ type Factories<T extends Target> = { [K in Kind<T> as CamelCase<K>]: Factory<T, K>; };
5957
+ type ShadowsocksBase = Omit<Options$1<"inbounds", "shadowsocks">, "method" | "users" | "managed">;
5958
+ type Method = Options$1<"inbounds", "shadowsocks">["method"];
5959
+ type MultiMethod$1 = Exclude<Method, "none">;
3604
5960
  type ManagedShadowsocks = ShadowsocksBase & {
3605
- method: MultiMethod;
5961
+ method: MultiMethod$1;
3606
5962
  managed: true;
3607
5963
  users?: readonly [];
3608
5964
  };
3609
5965
  type StaticShadowsocks = ShadowsocksBase & {
3610
- method: MultiMethod;
5966
+ method: MultiMethod$1;
3611
5967
  managed?: false;
3612
5968
  users: readonly [ShadowsocksEntry, ...ShadowsocksEntry[]];
3613
5969
  };
@@ -3616,359 +5972,308 @@ type ShadowsocksOptions = ShadowsocksBase & ({
3616
5972
  managed?: false;
3617
5973
  users?: readonly [];
3618
5974
  } | {
3619
- method: MultiMethod;
5975
+ method: MultiMethod$1;
3620
5976
  managed?: boolean;
3621
5977
  users?: readonly [];
3622
5978
  } | {
3623
- method: MultiMethod;
5979
+ method: MultiMethod$1;
3624
5980
  managed?: false;
3625
5981
  users?: readonly ShadowsocksEntry[];
3626
5982
  });
3627
- declare function makeShadowsocks(options: ManagedShadowsocks | StaticShadowsocks): Built<typeof shadowsocks> & SsmInbound;
3628
- declare function makeShadowsocks(options: ShadowsocksOptions): Built<typeof shadowsocks>;
3629
- export declare const inbound: Readonly<{
3630
- mixed: (options: Override<Options<typeof mixed>, {
3631
- users?: readonly MixedEntry[];
3632
- }>) => Built<{
3633
- readonly target: "inbounds";
3634
- readonly kind: "mixed";
3635
- readonly required: readonly ["tag"];
3636
- readonly optional: readonly ["users", "set_system_proxy"];
3637
- readonly listen: "forwarding";
3638
- readonly tls: "server";
3639
- readonly auth: {
3640
- readonly name: "username";
3641
- readonly credentials: readonly ["password"];
3642
- readonly required: readonly ["password"];
3643
- readonly allowRaw: true;
3644
- };
3645
- }, string>;
3646
- socks: (options: Override<Options<typeof socks>, {
3647
- users?: readonly PasswordEntry<"username">[];
3648
- }>) => Built<{
3649
- readonly target: "inbounds";
3650
- readonly kind: "socks";
3651
- readonly required: readonly ["tag"];
3652
- readonly optional: readonly ["users"];
3653
- readonly listen: "forwarding";
3654
- readonly auth: {
3655
- readonly name: "username";
3656
- readonly credentials: readonly ["password"];
3657
- readonly required: readonly ["password"];
3658
- };
3659
- }, string>;
3660
- vless: (options: Override<Options<typeof inboundVless>, {
3661
- users: readonly VlessEntry[];
3662
- }>) => Built<{
3663
- readonly target: "inbounds";
3664
- readonly kind: "vless";
3665
- readonly required: readonly ["tag", "users"];
3666
- readonly listen: "forwarding";
3667
- readonly tls: "server-reality";
3668
- readonly auth: {
3669
- readonly name: "name";
3670
- readonly credentials: readonly ["uuid", "flow"];
3671
- readonly required: readonly ["uuid"];
3672
- };
3673
- }, string>;
3674
- shadowsocks: typeof makeShadowsocks;
3675
- }>;
3676
- declare const api: {
3677
- readonly target: "services";
3678
- readonly kind: "api";
3679
- readonly required: readonly [];
3680
- readonly optional: readonly ["tag", "secret", "dashboard", "access_control_allow_origin", "access_control_allow_private_network"];
3681
- readonly listen: "listener";
3682
- readonly tls: "server";
3683
- readonly references: {
3684
- readonly dashboard: Expand;
5983
+ type InboundUsers<O, K extends AuthKind> = O extends {
5984
+ users?: readonly (infer Entry)[];
5985
+ } ? Omit<O, "users"> & (O extends {
5986
+ users: unknown;
5987
+ } ? {
5988
+ readonly users: readonly User[];
5989
+ } : {
5990
+ readonly users?: readonly (User | ((typeof authOptions)[K]["allowRaw"] extends true ? Entry & {
5991
+ user?: never;
5992
+ } : never))[];
5993
+ }) : O;
5994
+ type InboundFactories = Omit<Factories<"inbounds">, AuthKind> & { [K in Exclude<AuthKind, "shadowsocks">]: (options: StrictUnion<InboundUsers<Options$1<"inbounds", K>, K>>) => Built<"inbounds", K>; } & {
5995
+ shadowsocks: {
5996
+ (options: ManagedShadowsocks | StaticShadowsocks): Built<"inbounds", "shadowsocks"> & SsmInbound;
5997
+ (options: ShadowsocksOptions): Built<"inbounds", "shadowsocks">;
3685
5998
  };
3686
5999
  };
3687
- type RawDashboard = NonNullable<Extract<Service, {
3688
- type: "api";
3689
- }>["dashboard"]>;
3690
- type Dashboard = boolean | string | Override<ReadonlyJson<Extract<RawDashboard, object>>, {
3691
- http_client?: HttpClientInput;
6000
+ type RuleSetFactory<K extends "local" | "remote"> = <const T extends string | readonly string[]>(options: Omit<Options$1<"route.rule_set", K>, "tag"> & {
6001
+ readonly tag: T;
6002
+ }) => Built<"route.rule_set", K, T>;
6003
+ export declare const inbound: Readonly<InboundFactories>;
6004
+ export declare const outbound: Readonly<Factories<"outbounds">>;
6005
+ export declare const endpoint: Readonly<Factories<"endpoints">>;
6006
+ export declare const service: Readonly<Factories<"services">>;
6007
+ export declare const dnsServer: Readonly<Factories<"dns.servers">>;
6008
+ export declare const certificateProvider: Readonly<Factories<"certificate_providers">>;
6009
+ export declare const networkNamespace: Readonly<Factories<"network_namespaces">>;
6010
+ export declare const httpClient: Factory<"http_clients", "http-client">;
6011
+ export declare const ruleSet: Readonly<{
6012
+ inline(options: Omit<Options$1<"route.rule_set", "inline">, "tag"> & {
6013
+ tag: string;
6014
+ }): Built<"route.rule_set", "inline">;
6015
+ local: RuleSetFactory<"local">;
6016
+ remote: RuleSetFactory<"remote">;
3692
6017
  }>;
3693
- declare const ssmApi: {
3694
- readonly target: "services";
3695
- readonly kind: "ssm-api";
3696
- readonly required: readonly ["servers"];
3697
- readonly optional: readonly ["tag", "cache_path"];
3698
- readonly listen: "listener";
3699
- readonly tls: "server";
3700
- readonly references: {
3701
- readonly servers: Expand;
6018
+ type Protocol = Exclude<keyof UserCredentials, "mixed">;
6019
+ type TransportProtocol = "vmess" | "vless" | "trojan";
6020
+ type TlsUnsupported = "shadowsocks" | "snell" | "socks";
6021
+ type Catalog = SBKitInputs["factories"];
6022
+ type Options<T extends "inbounds" | "outbounds", K extends Protocol> = ReadonlyJson<Catalog[T][K]["options"]>;
6023
+ type Inbound<K extends Protocol> = ReturnType<(typeof inbound)[K]>;
6024
+ type Outbound<K extends Protocol> = ReturnType<(typeof outbound)[K]>;
6025
+ type Users = readonly [User, ...User[]];
6026
+ type Port = {
6027
+ readonly host: string;
6028
+ readonly port: number;
6029
+ };
6030
+ type Direct = {
6031
+ readonly connect: Port;
6032
+ readonly realm?: never;
6033
+ };
6034
+ type Hopping = {
6035
+ readonly host: string;
6036
+ readonly ports: string | readonly string[];
6037
+ };
6038
+ type HysteriaDirect = {
6039
+ readonly connect: StrictUnion<Port | Hopping>;
6040
+ readonly realm?: never;
6041
+ };
6042
+ type Transport = StrictUnion<{
6043
+ readonly type: "tcp" | "quic";
6044
+ } | ReadonlyJson<Pick<Extract<V2RayTransport$1, {
6045
+ type: "http";
6046
+ }>, "type" | "host" | "path" | "method">> | ReadonlyJson<Pick<Extract<V2RayTransport$1, {
6047
+ type: "ws";
6048
+ }>, "type" | "path" | "max_early_data" | "early_data_header_name">> | ReadonlyJson<Pick<Extract<V2RayTransport$1, {
6049
+ type: "grpc";
6050
+ }>, "type" | "service_name">> | ReadonlyJson<Pick<Extract<V2RayTransport$1, {
6051
+ type: "httpupgrade";
6052
+ }>, "type" | "host" | "path">>> & { readonly [Key in AllTransportSideFields]?: never; };
6053
+ type NormalTls = {
6054
+ readonly mode: "tls";
6055
+ readonly serverName?: string;
6056
+ readonly alpn?: string | readonly string[];
6057
+ };
6058
+ type RealityTls = {
6059
+ readonly mode: "reality";
6060
+ readonly serverName: string;
6061
+ readonly handshake: Port & Dial;
6062
+ readonly keyPair: {
6063
+ readonly privateKey: string;
6064
+ readonly publicKey: string;
3702
6065
  };
6066
+ } & StrictUnion<{
6067
+ readonly shortId: string;
6068
+ } | {
6069
+ readonly shortIds: readonly [string, ...string[]];
6070
+ }>;
6071
+ type NoTls = {
6072
+ readonly mode: "none";
3703
6073
  };
3704
- export declare const service: Readonly<{
3705
- /**
3706
- * sing-box defaults to loopback (127.0.0.1). An omitted or empty secret allows
3707
- * unauthenticated connections. Omitting server TLS uses plaintext TCP.
3708
- */
3709
- api: (options?: Override<Options<typeof api>, {
3710
- dashboard?: Dashboard;
3711
- }>) => Built<{
3712
- readonly target: "services";
3713
- readonly kind: "api";
3714
- readonly required: readonly [];
3715
- readonly optional: readonly ["tag", "secret", "dashboard", "access_control_allow_origin", "access_control_allow_private_network"];
3716
- readonly listen: "listener";
3717
- readonly tls: "server";
3718
- readonly references: {
3719
- readonly dashboard: Expand;
3720
- };
3721
- }, string | undefined>;
3722
- ssmApi: (options: Override<Options<typeof ssmApi>, {
3723
- servers: Readonly<Record<string, SsmInbound>>;
3724
- }>) => Built<{
3725
- readonly target: "services";
3726
- readonly kind: "ssm-api";
3727
- readonly required: readonly ["servers"];
3728
- readonly optional: readonly ["tag", "cache_path"];
3729
- readonly listen: "listener";
3730
- readonly tls: "server";
3731
- readonly references: {
3732
- readonly servers: Expand;
3733
- };
3734
- }, string | undefined>;
6074
+ type TransportTls<K extends TransportProtocol> = StrictUnion<{
6075
+ readonly transport: Transport;
6076
+ readonly tls: NormalTls;
6077
+ } | {
6078
+ readonly transport?: Exclude<Transport, {
6079
+ type: "tcp" | "quic";
6080
+ }> | {
6081
+ readonly type: "tcp";
6082
+ };
6083
+ readonly tls?: NormalTls | NoTls | (K extends "vless" ? RealityTls : never);
3735
6084
  }>;
3736
- declare const http: {
3737
- readonly target: "http_clients";
3738
- readonly kind: "http-client";
3739
- readonly required: readonly [];
3740
- readonly optional: readonly ["version", "headers", "tag"];
3741
- readonly dial: "detour";
3742
- readonly tls: "client";
6085
+ declare const sharedOption: {
6086
+ readonly hysteria: "obfs";
6087
+ readonly hysteria2: "obfs";
6088
+ readonly shadowsocks: "method";
3743
6089
  };
3744
- export declare function httpClient(options: Options<typeof http> & {
3745
- tag: string;
3746
- }): Built<typeof http, string>;
3747
- export declare function httpClient(options?: Options<typeof http>): Built<typeof http, string | undefined>;
3748
- declare function checkGroup(fields: Fields, path: string): void;
3749
- declare const selector: {
3750
- readonly target: "outbounds";
3751
- readonly kind: "selector";
3752
- readonly required: readonly ["tag", "outbounds"];
3753
- readonly optional: readonly ["default", "interrupt_exist_connections"];
3754
- readonly prepare: typeof checkGroup;
3755
- readonly references: {
3756
- readonly outbounds: Expand;
3757
- readonly default: Expand;
6090
+ declare const ownedServer: readonly ["tag", "users", "password", "version", "transport", "managed", "destinations", "psk", "mode", "obfs_mode", "realm", "handshake"];
6091
+ declare const ownedClient: readonly ["tag", "server", "server_port", "server_ports", "username", "password", "uuid", "flow", "alter_id", "auth", "auth_str", "userkey", "psk", "version", "transport", "mode", "obfs_mode", "realm"];
6092
+ type SharedOption<K extends Protocol> = K extends keyof typeof sharedOption ? (typeof sharedOption)[K] : never;
6093
+ type SideOptions<O, Keys extends PropertyKey> = O extends unknown ? Omit<O, Keys> & { readonly [K in Extract<Keys, keyof O | "version" | "transport">]?: never; } : never;
6094
+ type ProfileOutboundOptions<K extends Protocol, Input> = K extends "snell" ? Extract<StrictUnion<Options<"outbounds", "snell">>, {
6095
+ version: [Input] extends [{
6096
+ readonly version: 5;
6097
+ }] ? 4 : 6;
6098
+ }> : Options<"outbounds", K>;
6099
+ type Realm = ReadonlyJson<Required<Pick<Hysteria2InboundRealm$1, "server_url" | "realm_id" | "stun_servers">>> & ReadonlyJson<Pick<Hysteria2InboundRealm$1, "token">>;
6100
+ type RealmLocal = ReadonlyJson<Omit<Hysteria2InboundRealm$1, "server_url" | "realm_id" | "stun_servers">>;
6101
+ type ServerSettings<K extends Protocol, Input> = {
6102
+ readonly tag: string;
6103
+ readonly listen?: ReadonlyJson<Catalog["inbounds"][K]["listen"]> & {
6104
+ readonly address?: string;
3758
6105
  };
6106
+ readonly options?: SideOptions<Options<"inbounds", K>, (typeof ownedServer)[number] | SharedOption<K>>;
6107
+ readonly tls?: K extends TlsUnsupported | "shadowtls" ? never : ProtocolTlsOptions<K, ReadonlyJson<Omit<InboundTLSOptions$1, "enabled" | "reality">>>;
6108
+ readonly transport?: K extends TransportProtocol ? TransportSideOptions<ProfileTransport<Input>, false> : never;
6109
+ readonly realm?: K extends "hysteria2" ? RealmLocal : never;
6110
+ };
6111
+ type ClientTls$1 = ReadonlyJson<Omit<OutboundTLSOptions$1, "enabled" | "server_name" | "reality">>;
6112
+ type ClientSettings<K extends Protocol, Input> = {
6113
+ readonly tag: string;
6114
+ readonly dial?: ReadonlyJson<Catalog["outbounds"][K]["dial"]>;
6115
+ readonly options?: SideOptions<ProfileOutboundOptions<K, Input>, (typeof ownedClient)[number] | SharedOption<K>>;
6116
+ readonly tls?: K extends TlsUnsupported ? never : ProtocolTlsOptions<K, ClientTls$1>;
6117
+ readonly transport?: K extends TransportProtocol ? TransportSideOptions<ProfileTransport<Input>, true> : never;
6118
+ readonly realm?: K extends "hysteria2" ? Omit<RealmLocal, "stun_domain_resolver"> : never;
6119
+ readonly shortId?: K extends "vless" ? string : never;
6120
+ };
6121
+ interface Profile<K extends Protocol, Authenticated extends boolean, ExtraInbound = unknown, Input = unknown> {
6122
+ server(this: void, options: ServerSettings<K, Input>): Inbound<K> & ExtraInbound;
6123
+ client(this: void, ...args: Authenticated extends true ? [user: User, options: ClientSettings<K, Input>] : [options: ClientSettings<K, Input>]): Outbound<K>;
6124
+ }
6125
+ type TransportInput<K extends TransportProtocol> = Direct & {
6126
+ readonly users: Users;
6127
+ } & TransportTls<K>;
6128
+ type PlainInput = Direct & {
6129
+ readonly tls?: NormalTls | NoTls;
3759
6130
  };
3760
- declare const urltest: {
3761
- readonly target: "outbounds";
3762
- readonly kind: "urltest";
3763
- readonly required: readonly ["tag", "outbounds"];
3764
- readonly optional: readonly ["url", "interval", "tolerance", "idle_timeout", "interrupt_exist_connections"];
3765
- readonly prepare: typeof checkGroup;
3766
- readonly references: {
3767
- readonly outbounds: Expand;
6131
+ type RequiredTlsInput<K extends Protocol = Protocol> = Direct & {
6132
+ readonly users: Users;
6133
+ readonly tls: ProtocolTlsOptions<K, NormalTls>;
6134
+ };
6135
+ type HysteriaInput = HysteriaDirect & Pick<RequiredTlsInput, "users" | "tls"> & Pick<Options<"inbounds", "hysteria">, "obfs">;
6136
+ type Hysteria2Input = {
6137
+ readonly users: Users;
6138
+ } & Pick<Options<"inbounds", "hysteria2">, "obfs"> & ((HysteriaDirect & {
6139
+ readonly tls: NormalTls;
6140
+ }) | {
6141
+ readonly connect?: never;
6142
+ readonly realm: Realm;
6143
+ readonly tls: NormalTls & {
6144
+ readonly serverName: string;
3768
6145
  };
6146
+ });
6147
+ type SocksInput = Direct & {
6148
+ readonly version?: "4" | "4a" | "5";
3769
6149
  };
3770
- export declare const outbound: Readonly<{
3771
- direct: (options: {
3772
- readonly tag: string;
3773
- }) => Built<{
3774
- readonly target: "outbounds";
3775
- readonly kind: "direct";
3776
- readonly required: readonly ["tag"];
3777
- readonly dial: "direct";
3778
- }, string>;
3779
- vless: (options: {
3780
- readonly tag: string;
6150
+ type SnellInput = Direct & {
6151
+ readonly psk: string;
6152
+ } & StrictUnion<{
6153
+ readonly version: 5;
6154
+ readonly obfs_mode?: "none" | "http" | "tls";
6155
+ } | {
6156
+ readonly version?: 6;
6157
+ readonly mode?: "default" | "unshaped" | "unsafe-raw";
6158
+ }>;
6159
+ type ShadowTlsInput = Direct & {
6160
+ readonly handshake: ReadonlyJson<ShadowTLSHandshakeOptions$1> & {
3781
6161
  readonly server: string;
3782
6162
  readonly server_port: number;
3783
- readonly uuid: string;
3784
- readonly flow?: string;
3785
- }) => Built<{
3786
- readonly target: "outbounds";
3787
- readonly kind: "vless";
3788
- readonly required: readonly ["tag", "server", "server_port", "uuid"];
3789
- readonly optional: readonly ["flow"];
3790
- readonly dial: "detour";
3791
- readonly tls: "client-reality";
3792
- readonly startupDetour: true;
3793
- }, string>;
3794
- selector: (options: Override<Options<typeof selector>, {
3795
- outbounds: readonly Egress[];
3796
- default?: Egress;
3797
- }>) => Resource<"outbounds", "selector", string, "egress">;
3798
- urltest: (options: Override<Options<typeof urltest>, {
3799
- outbounds: readonly Egress[];
3800
- }>) => Resource<"outbounds", "urltest", string, "egress">;
3801
- }>;
3802
- export declare const endpoint: Readonly<{
3803
- tailscale: (options: {
3804
- readonly tag: string;
3805
- readonly state_directory?: string;
3806
- readonly auth_key?: string;
3807
- readonly hostname?: string;
3808
- readonly accept_routes?: boolean;
3809
- readonly exit_node?: string;
3810
- readonly listen_port?: number;
3811
- }) => Built<{
3812
- readonly target: "endpoints";
3813
- readonly kind: "tailscale";
3814
- readonly required: readonly ["tag"];
3815
- readonly optional: readonly ["state_directory", "auth_key", "hostname", "accept_routes", "exit_node", "listen_port"];
3816
- readonly dial: "detour";
3817
- readonly roles: readonly ["preferred-routes", "tailscale-endpoint"];
3818
- }, string>;
3819
- wireguard: (options: {
3820
- readonly tag: string;
3821
- readonly system?: boolean;
3822
- readonly address: string | readonly string[];
3823
- readonly private_key: string;
3824
- readonly listen_port?: number;
3825
- readonly peers?: readonly {
3826
- readonly address?: string;
3827
- readonly port?: number;
3828
- readonly public_key?: string;
3829
- readonly pre_shared_key?: string;
3830
- readonly allowed_ips?: string | readonly string[] | undefined;
3831
- readonly persistent_keepalive_interval?: number;
3832
- readonly reserved?: string | readonly number[] | undefined;
3833
- }[] | undefined;
3834
- }) => Built<{
3835
- readonly target: "endpoints";
3836
- readonly kind: "wireguard";
3837
- readonly required: readonly ["tag", "address", "private_key"];
3838
- readonly optional: readonly ["peers", "listen_port", "system"];
3839
- readonly dial: "detour";
3840
- readonly startupDetour: true;
3841
- readonly roles: readonly ["preferred-routes"];
3842
- readonly checkDial: (fields: Fields, dial: Fields, path: string) => void;
3843
- }, string>;
3844
- }>;
3845
- declare const tailscaleDns: {
3846
- readonly target: "dns.servers";
3847
- readonly kind: "tailscale";
3848
- readonly required: readonly ["tag", "endpoint"];
3849
- readonly optional: readonly ["accept_default_resolvers", "accept_search_domain"];
3850
- readonly roles: readonly ["preferred-domain"];
3851
- readonly references: {
3852
- readonly endpoint: Expand;
3853
6163
  };
6164
+ readonly serverName: string;
3854
6165
  };
3855
- export declare const dnsServer: Readonly<{
3856
- tcp: (options: {
3857
- readonly tag: string;
3858
- readonly server: string;
3859
- readonly server_port?: number;
3860
- }) => Built<{
3861
- readonly target: "dns.servers";
3862
- readonly required: readonly ["tag", "server"];
3863
- readonly optional: readonly ["server_port"];
3864
- readonly dial: "detour";
3865
- readonly remoteDns: true;
3866
- readonly kind: "tcp";
3867
- }, string>;
3868
- udp: (options: {
3869
- readonly tag: string;
3870
- readonly server: string;
3871
- readonly server_port?: number;
3872
- }) => Built<{
3873
- readonly target: "dns.servers";
3874
- readonly required: readonly ["tag", "server"];
3875
- readonly optional: readonly ["server_port"];
3876
- readonly dial: "detour";
3877
- readonly remoteDns: true;
3878
- readonly kind: "udp";
3879
- }, string>;
3880
- tls: (options: {
3881
- readonly tag: string;
3882
- readonly server: string;
3883
- readonly server_port?: number;
3884
- }) => Built<{
3885
- readonly target: "dns.servers";
3886
- readonly required: readonly ["tag", "server"];
3887
- readonly optional: readonly ["server_port"];
3888
- readonly dial: "detour";
3889
- readonly remoteDns: true;
3890
- readonly kind: "tls";
3891
- readonly tls: "client";
3892
- }, string>;
3893
- https: (options: {
3894
- readonly tag: string;
3895
- readonly server: string;
3896
- readonly server_port?: number;
3897
- readonly path?: string;
3898
- readonly headers?: {
3899
- readonly [x: string]: string | readonly string[];
3900
- } | undefined;
3901
- }) => Built<{
3902
- readonly target: "dns.servers";
3903
- readonly required: readonly ["tag", "server"];
3904
- readonly dial: "detour";
3905
- readonly remoteDns: true;
3906
- readonly kind: "https";
3907
- readonly tls: "client";
3908
- readonly optional: readonly ["server_port", "path", "headers"];
3909
- }, string>;
3910
- tailscale: (options: Override<Options<typeof tailscaleDns>, {
3911
- endpoint: TailscaleEndpoint;
3912
- }>) => Resource<"dns.servers", "tailscale", string, "dns-server" | "preferred-domain">;
6166
+ type ShadowsocksInput = Direct;
6167
+ type ShadowsocksMethod = Options<"inbounds", "shadowsocks">["method"];
6168
+ type MultiMethod = Exclude<ShadowsocksMethod, "none" | "2022-blake3-chacha20-poly1305">;
6169
+ type SharedPassword = StrictUnion<{
6170
+ readonly method: "none";
6171
+ } | {
6172
+ readonly method: Exclude<ShadowsocksMethod, "none">;
6173
+ readonly password: string;
6174
+ }>;
6175
+ type MultiPassword = StrictUnion<{
6176
+ readonly method: Extract<MultiMethod, `2022-${string}`>;
6177
+ readonly serverKey: string;
6178
+ } | {
6179
+ readonly method: Exclude<MultiMethod, `2022-${string}`>;
3913
6180
  }>;
3914
- declare const tailscaleProvider: {
3915
- readonly target: "certificate_providers";
3916
- readonly kind: "tailscale";
3917
- readonly required: readonly ["tag", "endpoint"];
3918
- readonly references: {
3919
- readonly endpoint: Expand;
6181
+ declare const localTransportFields: {
6182
+ readonly tcp: readonly [];
6183
+ readonly quic: readonly [];
6184
+ readonly http: readonly ["headers", "idle_timeout", "ping_timeout"];
6185
+ readonly ws: readonly ["headers"];
6186
+ readonly grpc: readonly ["idle_timeout", "ping_timeout"];
6187
+ readonly httpupgrade: readonly ["headers"];
6188
+ };
6189
+ declare const grpcClientFields: readonly ["permit_without_stream"];
6190
+ type TransportKind = keyof typeof localTransportFields;
6191
+ type TransportSelection<K extends TransportKind> = {
6192
+ readonly transport: {
6193
+ readonly type: K;
3920
6194
  };
3921
6195
  };
3922
- export declare const certificateProvider: Readonly<{
3923
- tailscale: (options: Override<Options<typeof tailscaleProvider>, {
3924
- endpoint: TailscaleEndpoint;
3925
- }>) => Resource<"certificate_providers", "tailscale", string, "certificate-provider">;
6196
+ type ProfileTransport<Input> = Input extends TransportSelection<infer K> ? K : "tcp";
6197
+ type TransportSideField<K extends TransportKind, Client extends boolean> = (typeof localTransportFields)[K][number] | (Client extends true ? (K extends "grpc" ? (typeof grpcClientFields)[number] : never) : never);
6198
+ type AllTransportSideFields = TransportSideField<TransportKind, true>;
6199
+ type CommonTransportSideFields<K extends TransportKind, Client extends boolean> = keyof (K extends TransportKind ? Record<TransportSideField<K, Client>, true> : never) & AllTransportSideFields;
6200
+ type TransportSideOptions<K extends TransportKind, Client extends boolean, Allowed extends AllTransportSideFields = CommonTransportSideFields<K, Client>> = [Allowed] extends [never] ? never : ReadonlyJson<Pick<StrictUnion<V2RayTransport$1>, Allowed>> & { readonly [Key in Exclude<AllTransportSideFields, Allowed>]?: never; };
6201
+ declare function http(input: PlainInput & {
6202
+ readonly users: Users;
6203
+ }): Profile<"http", true>;
6204
+ declare function http(input: PlainInput & {
6205
+ readonly users?: never;
6206
+ }): Profile<"http", false>;
6207
+ declare function socks(input: SocksInput & {
6208
+ readonly users: Users;
6209
+ }): Profile<"socks", true>;
6210
+ declare function socks(input: SocksInput & {
6211
+ readonly users?: never;
6212
+ }): Profile<"socks", false>;
6213
+ declare function snell<const Version extends 5 | 6 = 6>(input: SnellInput & {
6214
+ readonly version?: Version;
6215
+ readonly users: Users;
6216
+ }): Profile<"snell", true, unknown, {
6217
+ readonly version: Version;
3926
6218
  }>;
3927
- export declare const networkNamespace: Readonly<{
3928
- default: (options: {
3929
- readonly tag: string;
3930
- readonly path: string;
3931
- }) => Resource<"network_namespaces", "default", string, "netns">;
3932
- unshare: (options: {
3933
- readonly tag: string;
3934
- readonly pid_file?: string;
3935
- }) => Resource<"network_namespaces", "unshare", string, "netns">;
6219
+ declare function snell<const Version extends 5 | 6 = 6>(input: SnellInput & {
6220
+ readonly version?: Version;
6221
+ readonly users?: never;
6222
+ }): Profile<"snell", false, unknown, {
6223
+ readonly version: Version;
3936
6224
  }>;
3937
- declare const inlineRuleSet: {
3938
- readonly target: "route.rule_set";
3939
- readonly kind: "inline";
3940
- readonly required: readonly ["tag", "rules"];
3941
- readonly prepare: (fields: Fields, path: string) => void;
3942
- };
3943
- declare const localRuleSet: {
3944
- readonly target: "route.rule_set";
3945
- readonly kind: "local";
3946
- readonly required: readonly ["tag", "path"];
3947
- readonly optional: readonly ["format"];
3948
- readonly prepare: (fields: Fields, path: string) => void;
3949
- };
3950
- declare const remoteRuleSet: {
3951
- readonly target: "route.rule_set";
3952
- readonly kind: "remote";
3953
- readonly required: readonly ["tag", "url"];
3954
- readonly optional: readonly ["format", "initial_path", "update_interval", "http_client"];
3955
- readonly references: {
3956
- readonly http_client: Expand;
3957
- };
3958
- readonly prepare: (fields: Fields, path: string) => void;
3959
- };
3960
- export declare const ruleSet: Readonly<{
3961
- inline(options: {
3962
- tag: string;
3963
- rules: readonly ReadonlyJson<HeadlessRule>[];
3964
- }): Built<typeof inlineRuleSet>;
3965
- local<const T extends string | readonly string[]>(options: Override<Options<typeof localRuleSet>, {
3966
- tag: T;
3967
- }>): Resource<"route.rule_set", "local", T, "rule-set">;
3968
- remote<const T extends string | readonly string[]>(options: Override<Options<typeof remoteRuleSet>, {
3969
- tag: T;
3970
- http_client?: HttpClientInput;
3971
- }>): Resource<"route.rule_set", "remote", T, "rule-set">;
6225
+ declare function shadowtls(input: ShadowTlsInput & {
6226
+ readonly version?: 3;
6227
+ readonly users: Users;
6228
+ readonly password?: never;
6229
+ }): Profile<"shadowtls", true>;
6230
+ declare function shadowtls(input: ShadowTlsInput & {
6231
+ readonly version: 1;
6232
+ readonly users?: never;
6233
+ readonly password?: never;
6234
+ }): Profile<"shadowtls", false>;
6235
+ declare function shadowtls(input: ShadowTlsInput & {
6236
+ readonly version: 2;
6237
+ readonly users?: never;
6238
+ readonly password: string;
6239
+ }): Profile<"shadowtls", false>;
6240
+ declare function shadowsocks(input: ShadowsocksInput & MultiPassword & {
6241
+ readonly managed: true;
6242
+ readonly users?: never;
6243
+ readonly password?: never;
6244
+ }): Profile<"shadowsocks", true, SsmInbound>;
6245
+ declare function shadowsocks(input: ShadowsocksInput & MultiPassword & {
6246
+ readonly managed?: false;
6247
+ readonly users: Users;
6248
+ readonly password?: never;
6249
+ }): Profile<"shadowsocks", true, SsmInbound>;
6250
+ declare function shadowsocks(input: ShadowsocksInput & SharedPassword & {
6251
+ readonly managed?: false;
6252
+ readonly users?: never;
6253
+ readonly serverKey?: never;
6254
+ }): Profile<"shadowsocks", false>;
6255
+ export declare const proxyProfile: Readonly<{
6256
+ anytls: (input: RequiredTlsInput) => Profile<"anytls", true, unknown, unknown>;
6257
+ http: typeof http;
6258
+ hysteria: (input: HysteriaInput) => Profile<"hysteria", true, unknown, unknown>;
6259
+ hysteria2: (input: Hysteria2Input) => Profile<"hysteria2", true, unknown, unknown>;
6260
+ naive: (input: RequiredTlsInput<"naive">) => Profile<"naive", true, unknown, unknown>;
6261
+ shadowsocks: typeof shadowsocks;
6262
+ shadowtls: typeof shadowtls;
6263
+ snell: typeof snell;
6264
+ socks: typeof socks;
6265
+ trojan: {
6266
+ <const Transport extends TransportKind>(input: TransportInput<"trojan"> & TransportSelection<Transport>): Profile<"trojan", true, unknown, TransportSelection<Transport>>;
6267
+ (input: TransportInput<"trojan">): Profile<"trojan", true, unknown, unknown>;
6268
+ };
6269
+ tuic: (input: RequiredTlsInput) => Profile<"tuic", true, unknown, unknown>;
6270
+ vless: {
6271
+ <const Transport extends TransportKind>(input: TransportInput<"vless"> & TransportSelection<Transport>): Profile<"vless", true, unknown, TransportSelection<Transport>>;
6272
+ (input: TransportInput<"vless">): Profile<"vless", true, unknown, unknown>;
6273
+ };
6274
+ vmess: {
6275
+ <const Transport extends TransportKind>(input: TransportInput<"vmess"> & TransportSelection<Transport>): Profile<"vmess", true, unknown, TransportSelection<Transport>>;
6276
+ (input: TransportInput<"vmess">): Profile<"vmess", true, unknown, unknown>;
6277
+ };
3972
6278
  }>;
3973
- export declare function validateConfig(value: unknown): SingBoxConfig;
3974
- export type { ClientTls, CompileInput, Condition, Dial, DirectDial, DnsRuleAction, DomainResolver, HeadlessRule, HttpClientInput, InboundListener, InlineHttpClient, Listener, MatchFields, RealityClientTls, RealityServerTls, RouteRuleAction, RuleAction, RuleValue, Scope, ServerTls, SingBoxConfig, User };
6279
+ export type { ClientTls, CompileInput, Condition, Dial, DirectDial, DnsRuleAction, DomainResolver, HeadlessRule, HttpClientInput, InboundListener, InlineHttpClient, Listener, MatchFields, RealityClientTls, RealityServerTls, RouteRuleAction, RuleAction, RuleValue, Scope, ServerTls, SingBoxConfig, User, UserCredentials };