sub-store-convert 2.15.11 → 2.19.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +869 -156
- package/package.json +3 -2
package/build/index.js
CHANGED
|
@@ -80,7 +80,7 @@ start = (shadowsocks/vmess/trojan/https/http/snell/socks5/socks5_tls/tuic/tuic_v
|
|
|
80
80
|
return proxy;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/udp_port/others)* {
|
|
83
|
+
shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/udp_port/others)* {
|
|
84
84
|
proxy.type = "ss";
|
|
85
85
|
// handle obfs
|
|
86
86
|
if (obfs.type == "http" || obfs.type === "tls") {
|
|
@@ -91,7 +91,7 @@ shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/
|
|
|
91
91
|
}
|
|
92
92
|
handleShadowTLS();
|
|
93
93
|
}
|
|
94
|
-
vmess = tag equals "vmess" address (vmess_uuid/vmess_aead/ws/ws_path/ws_headers/method/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls/sni/tls_fingerprint/tls_verification/fast_open/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
94
|
+
vmess = tag equals "vmess" address (vmess_uuid/vmess_aead/ws/ws_path/ws_headers/method/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls/sni/tls_fingerprint/tls_verification/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
95
95
|
proxy.type = "vmess";
|
|
96
96
|
proxy.cipher = proxy.cipher || "none";
|
|
97
97
|
if (proxy.aead) {
|
|
@@ -102,25 +102,25 @@ vmess = tag equals "vmess" address (vmess_uuid/vmess_aead/ws/ws_path/ws_headers/
|
|
|
102
102
|
handleWebsocket();
|
|
103
103
|
handleShadowTLS();
|
|
104
104
|
}
|
|
105
|
-
trojan = tag equals "trojan" address (passwordk/ws/ws_path/ws_headers/tls/sni/tls_fingerprint/tls_verification/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
105
|
+
trojan = tag equals "trojan" address (passwordk/ws/ws_path/ws_headers/tls/sni/tls_fingerprint/tls_verification/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
106
106
|
proxy.type = "trojan";
|
|
107
107
|
handleWebsocket();
|
|
108
108
|
handleShadowTLS();
|
|
109
109
|
}
|
|
110
|
-
https = tag equals "https" address (username password)? (usernamek passwordk)? (sni/tls_fingerprint/tls_verification/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
110
|
+
https = tag equals "https" address (username password)? (usernamek passwordk)? (sni/tls_fingerprint/tls_verification/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
111
111
|
proxy.type = "http";
|
|
112
112
|
proxy.tls = true;
|
|
113
113
|
handleShadowTLS();
|
|
114
114
|
}
|
|
115
|
-
http = tag equals "http" address (username password)? (usernamek passwordk)? (ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
115
|
+
http = tag equals "http" address (username password)? (usernamek passwordk)? (ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
116
116
|
proxy.type = "http";
|
|
117
117
|
handleShadowTLS();
|
|
118
118
|
}
|
|
119
|
-
ssh = tag equals "ssh" address (username password)? (usernamek passwordk)? (server_fingerprint/idle_timeout/private_key/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
119
|
+
ssh = tag equals "ssh" address (username password)? (usernamek passwordk)? (server_fingerprint/idle_timeout/private_key/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
120
120
|
proxy.type = "ssh";
|
|
121
121
|
handleShadowTLS();
|
|
122
122
|
}
|
|
123
|
-
snell = tag equals "snell" address (snell_version/snell_psk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/udp_relay/reuse/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
123
|
+
snell = tag equals "snell" address (snell_version/snell_psk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/reuse/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
124
124
|
proxy.type = "snell";
|
|
125
125
|
// handle obfs
|
|
126
126
|
if (obfs.type == "http" || obfs.type === "tls") {
|
|
@@ -143,20 +143,20 @@ wireguard = tag equals "wireguard" (section_name/no_error_alert/ip_version/under
|
|
|
143
143
|
proxy.type = "wireguard-surge";
|
|
144
144
|
handleShadowTLS();
|
|
145
145
|
}
|
|
146
|
-
hysteria2 = tag equals "hysteria2" address (no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/sni/tls_verification/passwordk/tls_fingerprint/download_bandwidth/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* {
|
|
146
|
+
hysteria2 = tag equals "hysteria2" address (no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/sni/fast_open/tfo/tls_verification/passwordk/tls_fingerprint/download_bandwidth/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* {
|
|
147
147
|
proxy.type = "hysteria2";
|
|
148
148
|
handleShadowTLS();
|
|
149
149
|
}
|
|
150
|
-
socks5 = tag equals "socks5" address (username password)? (usernamek passwordk)? (udp_relay/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/
|
|
150
|
+
socks5 = tag equals "socks5" address (username password)? (usernamek passwordk)? (udp_relay/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
151
151
|
proxy.type = "socks5";
|
|
152
152
|
handleShadowTLS();
|
|
153
153
|
}
|
|
154
|
-
socks5_tls = tag equals "socks5-tls" address (username password)? (usernamek passwordk)? (udp_relay/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/sni/tls_fingerprint/tls_verification/fast_open/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
154
|
+
socks5_tls = tag equals "socks5-tls" address (username password)? (usernamek passwordk)? (udp_relay/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/sni/tls_fingerprint/tls_verification/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
155
155
|
proxy.type = "socks5";
|
|
156
156
|
proxy.tls = true;
|
|
157
157
|
handleShadowTLS();
|
|
158
158
|
}
|
|
159
|
-
direct = tag equals "direct" (udp_relay/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/block_quic/others)* {
|
|
159
|
+
direct = tag equals "direct" (udp_relay/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/block_quic/others)* {
|
|
160
160
|
proxy.type = "direct";
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -285,7 +285,7 @@ block_quic = comma "block-quic" equals match:[^,]+ { proxy["block-quic"] = match
|
|
|
285
285
|
udp_port = comma "udp-port" equals match:$[0-9]+ { proxy["udp-port"] = parseInt(match.trim()); }
|
|
286
286
|
shadow_tls_version = comma "shadow-tls-version" equals match:$[0-9]+ { proxy["shadow-tls-version"] = parseInt(match.trim()); }
|
|
287
287
|
shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { proxy["shadow-tls-sni"] = match.join(""); }
|
|
288
|
-
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join(""); }
|
|
288
|
+
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
|
289
289
|
token = comma "token" equals match:[^,]+ { proxy.token = match.join(""); }
|
|
290
290
|
alpn = comma "alpn" equals match:[^,]+ { proxy.alpn = match.join(""); }
|
|
291
291
|
uuidk = comma "uuid" equals match:[^,]+ { proxy.uuid = match.join(""); }
|
|
@@ -347,12 +347,12 @@ start = (shadowsocksr/shadowsocks/vmess/vless/trojan/https/http/socks5/hysteria2
|
|
|
347
347
|
return proxy;
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
shadowsocksr = tag equals "shadowsocksr"i address method password (ssr_protocol/ssr_protocol_param/obfs_ssr/obfs_ssr_param/obfs_host/obfs_uri/fast_open/udp_relay/others)*{
|
|
350
|
+
shadowsocksr = tag equals "shadowsocksr"i address method password (ssr_protocol/ssr_protocol_param/obfs_ssr/obfs_ssr_param/obfs_host/obfs_uri/fast_open/udp_relay/udp_port/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/others)*{
|
|
351
351
|
proxy.type = "ssr";
|
|
352
352
|
// handle ssr obfs
|
|
353
353
|
proxy.obfs = obfs.type;
|
|
354
354
|
}
|
|
355
|
-
shadowsocks = tag equals "shadowsocks"i address method password (obfs_typev obfs_hostv)? (obfs_ss/obfs_host/obfs_uri/fast_open/udp_relay/others)* {
|
|
355
|
+
shadowsocks = tag equals "shadowsocks"i address method password (obfs_typev obfs_hostv)? (obfs_ss/obfs_host/obfs_uri/fast_open/udp_relay/udp_port/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/others)* {
|
|
356
356
|
proxy.type = "ss";
|
|
357
357
|
// handle ss obfs
|
|
358
358
|
if (obfs.type == "http" || obfs.type === "tls") {
|
|
@@ -362,31 +362,31 @@ shadowsocks = tag equals "shadowsocks"i address method password (obfs_typev obfs
|
|
|
362
362
|
$set(proxy, "plugin-opts.path", obfs.path);
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
vmess = tag equals "vmess"i address method uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/vmess_alterId/fast_open/udp_relay/others)* {
|
|
365
|
+
vmess = tag equals "vmess"i address method uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/vmess_alterId/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/others)* {
|
|
366
366
|
proxy.type = "vmess";
|
|
367
367
|
proxy.cipher = proxy.cipher || "none";
|
|
368
368
|
proxy.alterId = proxy.alterId || 0;
|
|
369
369
|
handleTransport();
|
|
370
370
|
}
|
|
371
|
-
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
|
|
371
|
+
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/flow/public_key/short_id/block_quic/others)* {
|
|
372
372
|
proxy.type = "vless";
|
|
373
373
|
handleTransport();
|
|
374
374
|
}
|
|
375
|
-
trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
|
|
375
|
+
trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/block_quic/others)* {
|
|
376
376
|
proxy.type = "trojan";
|
|
377
377
|
handleTransport();
|
|
378
378
|
}
|
|
379
|
-
hysteria2 = tag equals "hysteria2"i address password (tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/udp_relay/fast_open/download_bandwidth/salamander_password/ecn/others)* {
|
|
379
|
+
hysteria2 = tag equals "hysteria2"i address password (tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/udp_relay/fast_open/download_bandwidth/salamander_password/ecn/ip_mode/block_quic/others)* {
|
|
380
380
|
proxy.type = "hysteria2";
|
|
381
381
|
}
|
|
382
|
-
https = tag equals "https"i address (username password)? (tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
|
|
382
|
+
https = tag equals "https"i address (username password)? (tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/block_quic/others)* {
|
|
383
383
|
proxy.type = "http";
|
|
384
384
|
proxy.tls = true;
|
|
385
385
|
}
|
|
386
|
-
http = tag equals "http"i address (username password)? (fast_open/udp_relay/others)* {
|
|
386
|
+
http = tag equals "http"i address (username password)? (fast_open/udp_relay/ip_mode/block_quic/others)* {
|
|
387
387
|
proxy.type = "http";
|
|
388
388
|
}
|
|
389
|
-
socks5 = tag equals "socks5"i address (username password)? (over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
|
|
389
|
+
socks5 = tag equals "socks5"i address (username password)? (over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/block_quic/others)* {
|
|
390
390
|
proxy.type = "socks5";
|
|
391
391
|
}
|
|
392
392
|
|
|
@@ -477,19 +477,31 @@ ssr_protocol_param = comma "protocol-param" equals param:$[^=,]+ { proxy["protoc
|
|
|
477
477
|
|
|
478
478
|
vmess_alterId = comma "alterId" equals alterId:$[0-9]+ { proxy.alterId = parseInt(alterId); }
|
|
479
479
|
|
|
480
|
+
udp_port = comma "udp-port" equals match:$[0-9]+ { proxy["udp-port"] = parseInt(match.trim()); }
|
|
481
|
+
shadow_tls_version = comma "shadow-tls-version" equals match:$[0-9]+ { proxy["shadow-tls-version"] = parseInt(match.trim()); }
|
|
482
|
+
shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { proxy["shadow-tls-sni"] = match.join(""); }
|
|
483
|
+
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join(""); }
|
|
484
|
+
|
|
480
485
|
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
|
|
481
486
|
tls_host = comma sni:("tls-name"/"sni") equals host:domain { proxy.sni = host; }
|
|
482
487
|
tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; }
|
|
483
488
|
tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
484
489
|
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
485
490
|
|
|
491
|
+
flow = comma "flow" equals match:[^,]+ { proxy["flow"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
492
|
+
public_key = comma "public-key" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["public-key"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
493
|
+
short_id = comma "short-id" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["short-id"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
494
|
+
|
|
486
495
|
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
|
|
487
496
|
udp_relay = comma "udp" equals flag:bool { proxy.udp = flag; }
|
|
497
|
+
ip_mode = comma "ip-mode" equals match:[^,]+ { proxy["ip-version"] = match.join(""); }
|
|
488
498
|
|
|
489
499
|
ecn = comma "ecn" equals flag:bool { proxy.ecn = flag; }
|
|
490
500
|
download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); }
|
|
491
501
|
salamander_password = comma "salamander-password" equals match:[^,]+ { proxy['obfs-password'] = match.join(""); proxy.obfs = 'salamander'; }
|
|
492
502
|
|
|
503
|
+
block_quic = comma "block-quic" equals flag:bool { if(flag) proxy["block-quic"] = "on"; else proxy["block-quic"] = "off"; }
|
|
504
|
+
|
|
493
505
|
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
|
|
494
506
|
comma = _ "," _
|
|
495
507
|
equals = _ "=" _
|
|
@@ -557,7 +569,7 @@ trojan = "trojan" equals address
|
|
|
557
569
|
}
|
|
558
570
|
|
|
559
571
|
shadowsocks = "shadowsocks" equals address
|
|
560
|
-
(password/method/obfs_ssr/obfs_ss/obfs_host/obfs_uri/ssr_protocol/ssr_protocol_param/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/udp_relay/
|
|
572
|
+
(password/method/obfs_ssr/obfs_ss/obfs_host/obfs_uri/ssr_protocol/ssr_protocol_param/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/udp_relay/udp_over_tcp_new/fast_open/tag/server_check_url/others)* {
|
|
561
573
|
if (proxy.protocol || proxy.type === "ssr") {
|
|
562
574
|
proxy.type = "ssr";
|
|
563
575
|
if (!proxy.protocol) {
|
|
@@ -653,18 +665,20 @@ port = digits:[0-9]+ {
|
|
|
653
665
|
}
|
|
654
666
|
}
|
|
655
667
|
|
|
656
|
-
username = comma "username" equals username:[
|
|
657
|
-
password = comma "password" equals password:[
|
|
658
|
-
uuid = comma "password" equals uuid:[
|
|
668
|
+
username = comma "username" equals username:[^,]+ { proxy.username = username.join("").trim(); }
|
|
669
|
+
password = comma "password" equals password:[^,]+ { proxy.password = password.join("").trim(); }
|
|
670
|
+
uuid = comma "password" equals uuid:[^,]+ { proxy.uuid = uuid.join("").trim(); }
|
|
659
671
|
|
|
660
672
|
method = comma "method" equals cipher:cipher {
|
|
661
673
|
proxy.cipher = cipher;
|
|
662
674
|
};
|
|
663
|
-
cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"bf-cfb"/"cast5-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"des-cfb"/"none"/"rc2-cfb"/"rc4-md5-6"/"rc4-md5"/"salsa20"/"xchacha20-ietf-poly1305");
|
|
675
|
+
cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"bf-cfb"/"cast5-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"des-cfb"/"none"/"rc2-cfb"/"rc4-md5-6"/"rc4-md5"/"salsa20"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm");
|
|
664
676
|
aead = comma "aead" equals flag:bool { proxy.aead = flag; }
|
|
665
677
|
|
|
666
678
|
udp_relay = comma "udp-relay" equals flag:bool { proxy.udp = flag; }
|
|
667
679
|
udp_over_tcp = comma "udp-over-tcp" equals flag:bool { throw new Error("UDP over TCP is not supported"); }
|
|
680
|
+
udp_over_tcp_new = comma "udp-over-tcp" equals param:$[^=,]+ { if (param === "sp.v1") { proxy["udp-over-tcp"] = true; proxy["udp-over-tcp-version"] = 1; } else if (param === "sp.v2") { proxy["udp-over-tcp"] = true; proxy["udp-over-tcp-version"] = 2; } else if (param === "true") { proxy["_ssr_python_uot"] = true; } else { throw new Error("Invalid value for udp-over-tcp"); } }
|
|
681
|
+
|
|
668
682
|
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
|
|
669
683
|
|
|
670
684
|
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
|
|
@@ -794,6 +808,9 @@ port = digits:[0-9]+ {
|
|
|
794
808
|
}
|
|
795
809
|
|
|
796
810
|
params = "?" head:param tail:("&"@param)* {
|
|
811
|
+
for (const [key, value] of Object.entries(params)) {
|
|
812
|
+
params[key] = decodeURIComponent(value);
|
|
813
|
+
}
|
|
797
814
|
proxy["skip-cert-verify"] = toBool(params["allowInsecure"]);
|
|
798
815
|
proxy.sni = params["sni"] || params["peer"];
|
|
799
816
|
proxy['client-fingerprint'] = params.fp;
|
|
@@ -829,6 +846,27 @@ params = "?" head:param tail:("&"@param)* {
|
|
|
829
846
|
$set(proxy, proxy.network+"-opts.v2ray-http-upgrade-fast-open", true);
|
|
830
847
|
}
|
|
831
848
|
}
|
|
849
|
+
if (['reality'].includes(params.security)) {
|
|
850
|
+
const opts = {};
|
|
851
|
+
if (params.pbk) {
|
|
852
|
+
opts['public-key'] = params.pbk;
|
|
853
|
+
}
|
|
854
|
+
if (params.sid) {
|
|
855
|
+
opts['short-id'] = params.sid;
|
|
856
|
+
}
|
|
857
|
+
if (params.spx) {
|
|
858
|
+
opts['_spider-x'] = params.spx;
|
|
859
|
+
}
|
|
860
|
+
if (params.mode) {
|
|
861
|
+
proxy._mode = params.mode;
|
|
862
|
+
}
|
|
863
|
+
if (params.extra) {
|
|
864
|
+
proxy._extra = params.extra;
|
|
865
|
+
}
|
|
866
|
+
if (Object.keys(opts).length > 0) {
|
|
867
|
+
$set(proxy, params.security+"-opts", opts);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
832
870
|
}
|
|
833
871
|
|
|
834
872
|
proxy.udp = toBool(params["udp"]);
|
|
@@ -857,6 +895,18 @@ function getParser4() {
|
|
|
857
895
|
return parser4;
|
|
858
896
|
}
|
|
859
897
|
|
|
898
|
+
// src/core/app/index.js
|
|
899
|
+
var app_default = new Proxy(console, {
|
|
900
|
+
get: function(target, prop) {
|
|
901
|
+
if (prop in target) {
|
|
902
|
+
return target[prop];
|
|
903
|
+
}
|
|
904
|
+
return function() {
|
|
905
|
+
return void 0;
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
|
|
860
910
|
// src/vendors/Sub-Store/backend/src/core/proxy-utils/parsers/index.js
|
|
861
911
|
import { Base64 } from "js-base64";
|
|
862
912
|
function surge_port_hopping(raw) {
|
|
@@ -875,8 +925,21 @@ function URI_PROXY() {
|
|
|
875
925
|
};
|
|
876
926
|
const parse = (line) => {
|
|
877
927
|
let [__, type, tls, username, password, server, port, query, name2] = line.match(
|
|
878
|
-
/^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?)
|
|
928
|
+
/^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/
|
|
879
929
|
);
|
|
930
|
+
if (port) {
|
|
931
|
+
port = parseInt(port, 10);
|
|
932
|
+
} else {
|
|
933
|
+
if (tls) {
|
|
934
|
+
port = 443;
|
|
935
|
+
} else if (type === "http") {
|
|
936
|
+
port = 80;
|
|
937
|
+
} else {
|
|
938
|
+
app_default.error(`port is not present in line: ${line}`);
|
|
939
|
+
throw new Error(`port is not present in line: ${line}`);
|
|
940
|
+
}
|
|
941
|
+
app_default.info(`port is not present in line: ${line}, set to ${port}`);
|
|
942
|
+
}
|
|
880
943
|
const proxy = {
|
|
881
944
|
name: name2 != null ? decodeURIComponent(name2) : `${type} ${server}:${port}`,
|
|
882
945
|
type,
|
|
@@ -890,6 +953,39 @@ function URI_PROXY() {
|
|
|
890
953
|
};
|
|
891
954
|
return { name, test, parse };
|
|
892
955
|
}
|
|
956
|
+
function URI_SOCKS() {
|
|
957
|
+
const name = "URI SOCKS Parser";
|
|
958
|
+
const test = (line) => {
|
|
959
|
+
return /^socks:\/\//.test(line);
|
|
960
|
+
};
|
|
961
|
+
const parse = (line) => {
|
|
962
|
+
let [__, type, auth, server, port, query, name2] = line.match(
|
|
963
|
+
/^(socks)?:\/\/(?:(.*)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/
|
|
964
|
+
);
|
|
965
|
+
if (port) {
|
|
966
|
+
port = parseInt(port, 10);
|
|
967
|
+
} else {
|
|
968
|
+
app_default.error(`port is not present in line: ${line}`);
|
|
969
|
+
throw new Error(`port is not present in line: ${line}`);
|
|
970
|
+
}
|
|
971
|
+
let username, password;
|
|
972
|
+
if (auth) {
|
|
973
|
+
const parsed = Base64.decode(decodeURIComponent(auth)).split(":");
|
|
974
|
+
username = parsed[0];
|
|
975
|
+
password = parsed[1];
|
|
976
|
+
}
|
|
977
|
+
const proxy = {
|
|
978
|
+
name: name2 != null ? decodeURIComponent(name2) : `${type} ${server}:${port}`,
|
|
979
|
+
type: "socks5",
|
|
980
|
+
server,
|
|
981
|
+
port,
|
|
982
|
+
username,
|
|
983
|
+
password
|
|
984
|
+
};
|
|
985
|
+
return proxy;
|
|
986
|
+
};
|
|
987
|
+
return { name, test, parse };
|
|
988
|
+
}
|
|
893
989
|
function URI_SS() {
|
|
894
990
|
const name = "URI SS Parser";
|
|
895
991
|
const test = (line) => {
|
|
@@ -897,12 +993,12 @@ function URI_SS() {
|
|
|
897
993
|
};
|
|
898
994
|
const parse = (line) => {
|
|
899
995
|
let content = line.split("ss://")[1];
|
|
996
|
+
let name2 = line.split("#")[1];
|
|
900
997
|
const proxy = {
|
|
901
|
-
name: decodeURIComponent(line.split("#")[1]),
|
|
902
998
|
type: "ss"
|
|
903
999
|
};
|
|
904
1000
|
content = content.split("#")[0];
|
|
905
|
-
let serverAndPortArray = content.match(/@([
|
|
1001
|
+
let serverAndPortArray = content.match(/@([^/?]*)(\/|\?|$)/);
|
|
906
1002
|
let rawUserInfoStr = decodeURIComponent(content.split("@")[0]);
|
|
907
1003
|
let userInfoStr;
|
|
908
1004
|
if (rawUserInfoStr?.startsWith("2022-blake3-")) {
|
|
@@ -931,8 +1027,11 @@ function URI_SS() {
|
|
|
931
1027
|
}
|
|
932
1028
|
content = `${content}${query}`;
|
|
933
1029
|
}
|
|
934
|
-
userInfoStr = content.
|
|
935
|
-
serverAndPortArray = content.match(/@([
|
|
1030
|
+
userInfoStr = content.match(/(^.*)@/)?.[1];
|
|
1031
|
+
serverAndPortArray = content.match(/@([^/@]*)(\/|$)/);
|
|
1032
|
+
} else if (content.includes("?")) {
|
|
1033
|
+
const parsed = content.match(/(\?.*)$/);
|
|
1034
|
+
query = parsed[1];
|
|
936
1035
|
}
|
|
937
1036
|
const serverAndPort = serverAndPortArray[1];
|
|
938
1037
|
const portIdx = serverAndPort.lastIndexOf(":");
|
|
@@ -943,9 +1042,10 @@ function URI_SS() {
|
|
|
943
1042
|
let userInfo = userInfoStr.match(/(^.*?):(.*$)/);
|
|
944
1043
|
proxy.cipher = userInfo?.[1];
|
|
945
1044
|
proxy.password = userInfo?.[2];
|
|
946
|
-
const
|
|
947
|
-
|
|
948
|
-
|
|
1045
|
+
const pluginMatch = content.match(/[?&]plugin=([^&]+)/);
|
|
1046
|
+
const shadowTlsMatch = content.match(/[?&]shadow-tls=([^&]+)/);
|
|
1047
|
+
if (pluginMatch) {
|
|
1048
|
+
const pluginInfo = ("plugin=" + decodeURIComponent(pluginMatch[1])).split(";");
|
|
949
1049
|
const params = {};
|
|
950
1050
|
for (const item of pluginInfo) {
|
|
951
1051
|
const [key, val] = item.split("=");
|
|
@@ -969,18 +1069,50 @@ function URI_SS() {
|
|
|
969
1069
|
tls: getIfPresent(params.tls)
|
|
970
1070
|
};
|
|
971
1071
|
break;
|
|
1072
|
+
case "shadow-tls": {
|
|
1073
|
+
proxy.plugin = "shadow-tls";
|
|
1074
|
+
const version = getIfNotBlank(params["version"]);
|
|
1075
|
+
proxy["plugin-opts"] = {
|
|
1076
|
+
host: getIfNotBlank(params["host"]),
|
|
1077
|
+
password: getIfNotBlank(params["password"]),
|
|
1078
|
+
version: version ? parseInt(version, 10) : void 0
|
|
1079
|
+
};
|
|
1080
|
+
break;
|
|
1081
|
+
}
|
|
972
1082
|
default:
|
|
973
1083
|
throw new Error(
|
|
974
1084
|
`Unsupported plugin option: ${params.plugin}`
|
|
975
1085
|
);
|
|
976
1086
|
}
|
|
977
1087
|
}
|
|
1088
|
+
if (shadowTlsMatch) {
|
|
1089
|
+
const params = JSON.parse(Base64.decode(shadowTlsMatch[1]));
|
|
1090
|
+
const version = getIfNotBlank(params["version"]);
|
|
1091
|
+
const address = getIfNotBlank(params["address"]);
|
|
1092
|
+
const port = getIfNotBlank(params["port"]);
|
|
1093
|
+
proxy.plugin = "shadow-tls";
|
|
1094
|
+
proxy["plugin-opts"] = {
|
|
1095
|
+
host: getIfNotBlank(params["host"]),
|
|
1096
|
+
password: getIfNotBlank(params["password"]),
|
|
1097
|
+
version: version ? parseInt(version, 10) : void 0
|
|
1098
|
+
};
|
|
1099
|
+
if (address) {
|
|
1100
|
+
proxy.server = address;
|
|
1101
|
+
}
|
|
1102
|
+
if (port) {
|
|
1103
|
+
proxy.port = parseInt(port, 10);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
978
1106
|
if (/(&|\?)uot=(1|true)/i.test(query)) {
|
|
979
1107
|
proxy["udp-over-tcp"] = true;
|
|
980
1108
|
}
|
|
981
1109
|
if (/(&|\?)tfo=(1|true)/i.test(query)) {
|
|
982
1110
|
proxy.tfo = true;
|
|
983
1111
|
}
|
|
1112
|
+
if (name2 != null) {
|
|
1113
|
+
name2 = decodeURIComponent(name2);
|
|
1114
|
+
}
|
|
1115
|
+
proxy.name = name2 ?? `SS ${proxy.server}:${proxy.port}`;
|
|
984
1116
|
return proxy;
|
|
985
1117
|
};
|
|
986
1118
|
return { name, test, parse };
|
|
@@ -1046,7 +1178,7 @@ function URI_VMess() {
|
|
|
1046
1178
|
};
|
|
1047
1179
|
const parse = (line) => {
|
|
1048
1180
|
line = line.split("vmess://")[1];
|
|
1049
|
-
let content = Base64.decode(line);
|
|
1181
|
+
let content = Base64.decode(line.replace(/\?.*?$/, ""));
|
|
1050
1182
|
if (/=\s*vmess/.test(content)) {
|
|
1051
1183
|
const partitions = content.split(",").map((p) => p.trim());
|
|
1052
1184
|
const params = {};
|
|
@@ -1132,8 +1264,12 @@ function URI_VMess() {
|
|
|
1132
1264
|
params.allowInsecure
|
|
1133
1265
|
);
|
|
1134
1266
|
}
|
|
1135
|
-
if (proxy.tls
|
|
1136
|
-
|
|
1267
|
+
if (proxy.tls) {
|
|
1268
|
+
if (params.sni && params.sni !== "") {
|
|
1269
|
+
proxy.sni = params.sni;
|
|
1270
|
+
} else if (params.peer && params.peer !== "") {
|
|
1271
|
+
proxy.sni = params.peer;
|
|
1272
|
+
}
|
|
1137
1273
|
}
|
|
1138
1274
|
let httpupgrade = false;
|
|
1139
1275
|
if (params.net === "ws" || params.obfs === "websocket") {
|
|
@@ -1159,6 +1295,9 @@ function URI_VMess() {
|
|
|
1159
1295
|
} catch (e) {
|
|
1160
1296
|
}
|
|
1161
1297
|
let transportPath = params.path;
|
|
1298
|
+
if (["ws"].includes(proxy.network)) {
|
|
1299
|
+
transportPath = transportPath || "/";
|
|
1300
|
+
}
|
|
1162
1301
|
if (proxy.network === "http") {
|
|
1163
1302
|
if (transportHost) {
|
|
1164
1303
|
transportHost = transportHost.split(",").map((i) => i.trim());
|
|
@@ -1260,6 +1399,9 @@ function URI_VLESS() {
|
|
|
1260
1399
|
if (params.sid) {
|
|
1261
1400
|
opts["short-id"] = params.sid;
|
|
1262
1401
|
}
|
|
1402
|
+
if (params.spx) {
|
|
1403
|
+
opts["_spider-x"] = params.spx;
|
|
1404
|
+
}
|
|
1263
1405
|
if (Object.keys(opts).length > 0) {
|
|
1264
1406
|
proxy[`${params.security}-opts`] = opts;
|
|
1265
1407
|
}
|
|
@@ -1274,6 +1416,9 @@ function URI_VLESS() {
|
|
|
1274
1416
|
}
|
|
1275
1417
|
if (!proxy.network && isShadowrocket && params.obfs) {
|
|
1276
1418
|
proxy.network = params.obfs;
|
|
1419
|
+
if (["none"].includes(proxy.network)) {
|
|
1420
|
+
proxy.network = "tcp";
|
|
1421
|
+
}
|
|
1277
1422
|
}
|
|
1278
1423
|
if (["websocket"].includes(proxy.network)) {
|
|
1279
1424
|
proxy.network = "ws";
|
|
@@ -1323,6 +1468,55 @@ function URI_VLESS() {
|
|
|
1323
1468
|
}
|
|
1324
1469
|
proxy.headerType = params.headerType || "none";
|
|
1325
1470
|
}
|
|
1471
|
+
if (params.mode) {
|
|
1472
|
+
proxy._mode = params.mode;
|
|
1473
|
+
}
|
|
1474
|
+
if (params.extra) {
|
|
1475
|
+
proxy._extra = params.extra;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
return proxy;
|
|
1479
|
+
};
|
|
1480
|
+
return { name, test, parse };
|
|
1481
|
+
}
|
|
1482
|
+
function URI_AnyTLS() {
|
|
1483
|
+
const name = "URI AnyTLS Parser";
|
|
1484
|
+
const test = (line) => {
|
|
1485
|
+
return /^anytls:\/\//.test(line);
|
|
1486
|
+
};
|
|
1487
|
+
const parse = (line) => {
|
|
1488
|
+
line = line.split(/anytls:\/\//)[1];
|
|
1489
|
+
let [__, password, server, port, addons = "", name2] = /^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(line);
|
|
1490
|
+
password = decodeURIComponent(password);
|
|
1491
|
+
port = parseInt(`${port}`, 10);
|
|
1492
|
+
if (isNaN(port)) {
|
|
1493
|
+
port = 443;
|
|
1494
|
+
}
|
|
1495
|
+
password = decodeURIComponent(password);
|
|
1496
|
+
if (name2 != null) {
|
|
1497
|
+
name2 = decodeURIComponent(name2);
|
|
1498
|
+
}
|
|
1499
|
+
name2 = name2 ?? `AnyTLS ${server}:${port}`;
|
|
1500
|
+
const proxy = {
|
|
1501
|
+
type: "anytls",
|
|
1502
|
+
name: name2,
|
|
1503
|
+
server,
|
|
1504
|
+
port,
|
|
1505
|
+
password
|
|
1506
|
+
};
|
|
1507
|
+
for (const addon of addons.split("&")) {
|
|
1508
|
+
let [key, value] = addon.split("=");
|
|
1509
|
+
key = key.replace(/_/g, "-");
|
|
1510
|
+
value = decodeURIComponent(value);
|
|
1511
|
+
if (["alpn"].includes(key)) {
|
|
1512
|
+
proxy[key] = value ? value.split(",") : void 0;
|
|
1513
|
+
} else if (["insecure"].includes(key)) {
|
|
1514
|
+
proxy["skip-cert-verify"] = /(TRUE)|1/i.test(value);
|
|
1515
|
+
} else if (["udp"].includes(key)) {
|
|
1516
|
+
proxy[key] = /(TRUE)|1/i.test(value);
|
|
1517
|
+
} else {
|
|
1518
|
+
proxy[key] = value;
|
|
1519
|
+
}
|
|
1326
1520
|
}
|
|
1327
1521
|
return proxy;
|
|
1328
1522
|
};
|
|
@@ -1390,11 +1584,21 @@ function URI_Hysteria2() {
|
|
|
1390
1584
|
if (params.obfs && params.obfs !== "none") {
|
|
1391
1585
|
proxy.obfs = params.obfs;
|
|
1392
1586
|
}
|
|
1393
|
-
|
|
1587
|
+
if (params.mport) {
|
|
1588
|
+
proxy.ports = params.mport;
|
|
1589
|
+
}
|
|
1394
1590
|
proxy["obfs-password"] = params["obfs-password"];
|
|
1395
1591
|
proxy["skip-cert-verify"] = /(TRUE)|1/i.test(params.insecure);
|
|
1396
1592
|
proxy.tfo = /(TRUE)|1/i.test(params.fastopen);
|
|
1397
1593
|
proxy["tls-fingerprint"] = params.pinSHA256;
|
|
1594
|
+
let hop_interval = params["hop-interval"] || params["hop_interval"];
|
|
1595
|
+
if (/^\d+$/.test(hop_interval)) {
|
|
1596
|
+
proxy["hop-interval"] = parseInt(`${hop_interval}`, 10);
|
|
1597
|
+
}
|
|
1598
|
+
let keepalive = params["keepalive"];
|
|
1599
|
+
if (/^\d+$/.test(keepalive)) {
|
|
1600
|
+
proxy["keepalive"] = parseInt(`${keepalive}`, 10);
|
|
1601
|
+
}
|
|
1398
1602
|
return proxy;
|
|
1399
1603
|
};
|
|
1400
1604
|
return { name, test, parse };
|
|
@@ -1468,7 +1672,10 @@ function URI_TUIC() {
|
|
|
1468
1672
|
};
|
|
1469
1673
|
const parse = (line) => {
|
|
1470
1674
|
line = line.split(/tuic:\/\//)[1];
|
|
1471
|
-
let [__,
|
|
1675
|
+
let [__, auth, server, port, addons = "", name2] = /^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(line);
|
|
1676
|
+
auth = decodeURIComponent(auth);
|
|
1677
|
+
let [uuid, ...passwordParts] = auth.split(":");
|
|
1678
|
+
let password = passwordParts.join(":");
|
|
1472
1679
|
port = parseInt(`${port}`, 10);
|
|
1473
1680
|
if (isNaN(port)) {
|
|
1474
1681
|
port = 443;
|
|
@@ -1488,14 +1695,19 @@ function URI_TUIC() {
|
|
|
1488
1695
|
};
|
|
1489
1696
|
for (const addon of addons.split("&")) {
|
|
1490
1697
|
let [key, value] = addon.split("=");
|
|
1491
|
-
key = key.replace(/_
|
|
1698
|
+
key = key.replace(/_/g, "-");
|
|
1492
1699
|
value = decodeURIComponent(value);
|
|
1493
1700
|
if (["alpn"].includes(key)) {
|
|
1494
1701
|
proxy[key] = value ? value.split(",") : void 0;
|
|
1495
1702
|
} else if (["allow-insecure"].includes(key)) {
|
|
1496
1703
|
proxy["skip-cert-verify"] = /(TRUE)|1/i.test(value);
|
|
1704
|
+
} else if (["fast-open"].includes(key)) {
|
|
1705
|
+
proxy.tfo = true;
|
|
1497
1706
|
} else if (["disable-sni", "reduce-rtt"].includes(key)) {
|
|
1498
1707
|
proxy[key] = /(TRUE)|1/i.test(value);
|
|
1708
|
+
} else if (key === "congestion-control") {
|
|
1709
|
+
proxy["congestion-controller"] = value;
|
|
1710
|
+
delete proxy[key];
|
|
1499
1711
|
} else {
|
|
1500
1712
|
proxy[key] = value;
|
|
1501
1713
|
}
|
|
@@ -1614,6 +1826,7 @@ function Clash_All() {
|
|
|
1614
1826
|
const parse = (line) => {
|
|
1615
1827
|
const proxy = JSON.parse(line);
|
|
1616
1828
|
if (![
|
|
1829
|
+
"anytls",
|
|
1617
1830
|
"mieru",
|
|
1618
1831
|
"juicity",
|
|
1619
1832
|
"ss",
|
|
@@ -2044,6 +2257,7 @@ function isIP(ip) {
|
|
|
2044
2257
|
}
|
|
2045
2258
|
var parsers_default = [
|
|
2046
2259
|
URI_PROXY(),
|
|
2260
|
+
URI_SOCKS(),
|
|
2047
2261
|
URI_SS(),
|
|
2048
2262
|
URI_SSR(),
|
|
2049
2263
|
URI_VMess(),
|
|
@@ -2053,6 +2267,7 @@ var parsers_default = [
|
|
|
2053
2267
|
URI_Hysteria(),
|
|
2054
2268
|
URI_Hysteria2(),
|
|
2055
2269
|
URI_Trojan(),
|
|
2270
|
+
URI_AnyTLS(),
|
|
2056
2271
|
Clash_All(),
|
|
2057
2272
|
Surge_Direct(),
|
|
2058
2273
|
Surge_SSH(),
|
|
@@ -2111,18 +2326,6 @@ function isPresent2(obj, attr) {
|
|
|
2111
2326
|
return typeof data !== "undefined" && data !== null;
|
|
2112
2327
|
}
|
|
2113
2328
|
|
|
2114
|
-
// src/core/app/index.js
|
|
2115
|
-
var app_default = new Proxy(console, {
|
|
2116
|
-
get: function(target, prop) {
|
|
2117
|
-
if (prop in target) {
|
|
2118
|
-
return target[prop];
|
|
2119
|
-
}
|
|
2120
|
-
return function() {
|
|
2121
|
-
return void 0;
|
|
2122
|
-
};
|
|
2123
|
-
}
|
|
2124
|
-
});
|
|
2125
|
-
|
|
2126
2329
|
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/surge.js
|
|
2127
2330
|
var targetPlatform = "Surge";
|
|
2128
2331
|
var ipVersions = {
|
|
@@ -2171,7 +2374,7 @@ function Surge_Producer() {
|
|
|
2171
2374
|
};
|
|
2172
2375
|
return { produce: produce2 };
|
|
2173
2376
|
}
|
|
2174
|
-
function shadowsocks(proxy
|
|
2377
|
+
function shadowsocks(proxy) {
|
|
2175
2378
|
const result = new Result(proxy);
|
|
2176
2379
|
result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
|
|
2177
2380
|
if (!proxy.cipher) {
|
|
@@ -2204,7 +2407,8 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
|
|
|
2204
2407
|
"chacha20",
|
|
2205
2408
|
"chacha20-ietf",
|
|
2206
2409
|
"none",
|
|
2207
|
-
|
|
2410
|
+
"2022-blake3-aes-128-gcm",
|
|
2411
|
+
"2022-blake3-aes-256-gcm"
|
|
2208
2412
|
].includes(proxy.cipher)) {
|
|
2209
2413
|
throw new Error(`cipher ${proxy.cipher} is not supported`);
|
|
2210
2414
|
}
|
|
@@ -2233,7 +2437,6 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
|
|
|
2233
2437
|
}
|
|
2234
2438
|
result.appendIfPresent(`,tfo=${proxy.tfo}`, "tfo");
|
|
2235
2439
|
result.appendIfPresent(`,udp-relay=${proxy.udp}`, "udp");
|
|
2236
|
-
result.appendIfPresent(`,udp-port=${proxy["udp-port"]}`, "udp-port");
|
|
2237
2440
|
result.appendIfPresent(`,test-url=${proxy["test-url"]}`, "test-url");
|
|
2238
2441
|
result.appendIfPresent(
|
|
2239
2442
|
`,test-timeout=${proxy["test-timeout"]}`,
|
|
@@ -2260,6 +2463,7 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
|
|
|
2260
2463
|
`,shadow-tls-sni=${proxy["shadow-tls-sni"]}`,
|
|
2261
2464
|
"shadow-tls-sni"
|
|
2262
2465
|
);
|
|
2466
|
+
result.appendIfPresent(`,udp-port=${proxy["udp-port"]}`, "udp-port");
|
|
2263
2467
|
} else if (["shadow-tls"].includes(proxy.plugin) && proxy["plugin-opts"]) {
|
|
2264
2468
|
const password = proxy["plugin-opts"].password;
|
|
2265
2469
|
const host = proxy["plugin-opts"].host;
|
|
@@ -2277,6 +2481,10 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
|
|
|
2277
2481
|
}
|
|
2278
2482
|
result.append(`,shadow-tls-version=${version}`);
|
|
2279
2483
|
}
|
|
2484
|
+
result.appendIfPresent(
|
|
2485
|
+
`,udp-port=${proxy["udp-port"]}`,
|
|
2486
|
+
"udp-port"
|
|
2487
|
+
);
|
|
2280
2488
|
}
|
|
2281
2489
|
}
|
|
2282
2490
|
result.appendIfPresent(`,block-quic=${proxy["block-quic"]}`, "block-quic");
|
|
@@ -2454,6 +2662,9 @@ function ssh(proxy) {
|
|
|
2454
2662
|
return result.toString();
|
|
2455
2663
|
}
|
|
2456
2664
|
function http(proxy) {
|
|
2665
|
+
if (proxy.headers && Object.keys(proxy.headers).length > 0) {
|
|
2666
|
+
throw new Error(`headers is unsupported`);
|
|
2667
|
+
}
|
|
2457
2668
|
const result = new Result(proxy);
|
|
2458
2669
|
const type = proxy.tls ? "https" : "http";
|
|
2459
2670
|
result.append(`${proxy.name}=${type},${proxy.server},${proxy.port}`);
|
|
@@ -3006,6 +3217,43 @@ function ClashMeta_Producer() {
|
|
|
3006
3217
|
return false;
|
|
3007
3218
|
} else if (["juicity"].includes(proxy.type)) {
|
|
3008
3219
|
return false;
|
|
3220
|
+
} else if (["ss"].includes(proxy.type) && ![
|
|
3221
|
+
"aes-128-ctr",
|
|
3222
|
+
"aes-192-ctr",
|
|
3223
|
+
"aes-256-ctr",
|
|
3224
|
+
"aes-128-cfb",
|
|
3225
|
+
"aes-192-cfb",
|
|
3226
|
+
"aes-256-cfb",
|
|
3227
|
+
"aes-128-gcm",
|
|
3228
|
+
"aes-192-gcm",
|
|
3229
|
+
"aes-256-gcm",
|
|
3230
|
+
"aes-128-ccm",
|
|
3231
|
+
"aes-192-ccm",
|
|
3232
|
+
"aes-256-ccm",
|
|
3233
|
+
"aes-128-gcm-siv",
|
|
3234
|
+
"aes-256-gcm-siv",
|
|
3235
|
+
"chacha20-ietf",
|
|
3236
|
+
"chacha20",
|
|
3237
|
+
"xchacha20",
|
|
3238
|
+
"chacha20-ietf-poly1305",
|
|
3239
|
+
"xchacha20-ietf-poly1305",
|
|
3240
|
+
"chacha8-ietf-poly1305",
|
|
3241
|
+
"xchacha8-ietf-poly1305",
|
|
3242
|
+
"2022-blake3-aes-128-gcm",
|
|
3243
|
+
"2022-blake3-aes-256-gcm",
|
|
3244
|
+
"2022-blake3-chacha20-poly1305",
|
|
3245
|
+
"lea-128-gcm",
|
|
3246
|
+
"lea-192-gcm",
|
|
3247
|
+
"lea-256-gcm",
|
|
3248
|
+
"rabbit128-poly1305",
|
|
3249
|
+
"aegis-128l",
|
|
3250
|
+
"aegis-256",
|
|
3251
|
+
"aez-384",
|
|
3252
|
+
"deoxys-ii-256-128",
|
|
3253
|
+
"rc4-md5",
|
|
3254
|
+
"none"
|
|
3255
|
+
].includes(proxy.cipher)) {
|
|
3256
|
+
return false;
|
|
3009
3257
|
}
|
|
3010
3258
|
return true;
|
|
3011
3259
|
}).map((proxy) => {
|
|
@@ -3022,9 +3270,10 @@ function ClashMeta_Producer() {
|
|
|
3022
3270
|
}
|
|
3023
3271
|
if (isPresent2(proxy, "cipher") && ![
|
|
3024
3272
|
"auto",
|
|
3273
|
+
"none",
|
|
3274
|
+
"zero",
|
|
3025
3275
|
"aes-128-gcm",
|
|
3026
|
-
"chacha20-poly1305"
|
|
3027
|
-
"none"
|
|
3276
|
+
"chacha20-poly1305"
|
|
3028
3277
|
].includes(proxy.cipher)) {
|
|
3029
3278
|
proxy.cipher = "auto";
|
|
3030
3279
|
}
|
|
@@ -3055,6 +3304,8 @@ function ClashMeta_Producer() {
|
|
|
3055
3304
|
proxy["persistent-keepalive"] = proxy.keepalive;
|
|
3056
3305
|
proxy["preshared-key"] = proxy["preshared-key"] ?? proxy["pre-shared-key"];
|
|
3057
3306
|
proxy["pre-shared-key"] = proxy["preshared-key"];
|
|
3307
|
+
} else if (proxy.type === "snell" && proxy.version < 3) {
|
|
3308
|
+
delete proxy.udp;
|
|
3058
3309
|
} else if (proxy.type === "vless") {
|
|
3059
3310
|
if (isPresent2(proxy, "sni")) {
|
|
3060
3311
|
proxy.servername = proxy.sni;
|
|
@@ -3068,6 +3319,9 @@ function ClashMeta_Producer() {
|
|
|
3068
3319
|
password: proxy["shadow-tls-password"],
|
|
3069
3320
|
version: proxy["shadow-tls-version"]
|
|
3070
3321
|
};
|
|
3322
|
+
delete proxy["shadow-tls-password"];
|
|
3323
|
+
delete proxy["shadow-tls-sni"];
|
|
3324
|
+
delete proxy["shadow-tls-version"];
|
|
3071
3325
|
}
|
|
3072
3326
|
}
|
|
3073
3327
|
if (["vmess", "vless"].includes(proxy.type) && proxy.network === "http") {
|
|
@@ -3100,7 +3354,8 @@ function ClashMeta_Producer() {
|
|
|
3100
3354
|
"tuic",
|
|
3101
3355
|
"hysteria",
|
|
3102
3356
|
"hysteria2",
|
|
3103
|
-
"juicity"
|
|
3357
|
+
"juicity",
|
|
3358
|
+
"anytls"
|
|
3104
3359
|
].includes(proxy.type)) {
|
|
3105
3360
|
delete proxy.tls;
|
|
3106
3361
|
}
|
|
@@ -3120,7 +3375,7 @@ function ClashMeta_Producer() {
|
|
|
3120
3375
|
delete proxy.id;
|
|
3121
3376
|
delete proxy.resolved;
|
|
3122
3377
|
delete proxy["no-resolve"];
|
|
3123
|
-
if (type2 !== "internal") {
|
|
3378
|
+
if (type2 !== "internal" || opts["delete-underscore-fields"]) {
|
|
3124
3379
|
for (const key in proxy) {
|
|
3125
3380
|
if (proxy[key] == null || /^_/i.test(key)) {
|
|
3126
3381
|
delete proxy[key];
|
|
@@ -3219,9 +3474,16 @@ function mihomo(proxy, type, opts) {
|
|
|
3219
3474
|
dns: {
|
|
3220
3475
|
enable: true,
|
|
3221
3476
|
ipv6,
|
|
3222
|
-
nameserver: [
|
|
3223
|
-
"
|
|
3224
|
-
"
|
|
3477
|
+
"default-nameserver": opts?.defaultNameserver || proxy._defaultNameserver || [
|
|
3478
|
+
"180.76.76.76",
|
|
3479
|
+
"52.80.52.52",
|
|
3480
|
+
"119.28.28.28",
|
|
3481
|
+
"223.6.6.6"
|
|
3482
|
+
],
|
|
3483
|
+
nameserver: opts?.nameserver || proxy._nameserver || [
|
|
3484
|
+
"https://doh.pub/dns-query",
|
|
3485
|
+
"https://dns.alidns.com/dns-query",
|
|
3486
|
+
"https://doh-pure.onedns.net/dns-query"
|
|
3225
3487
|
]
|
|
3226
3488
|
},
|
|
3227
3489
|
proxies: [
|
|
@@ -3290,6 +3552,11 @@ function Clash_Producer() {
|
|
|
3290
3552
|
"xchacha20-ietf-poly1305"
|
|
3291
3553
|
].includes(proxy.cipher) || proxy.type === "snell" && String(proxy.version) === "4" || proxy.type === "vless" && (typeof proxy.flow !== "undefined" || proxy["reality-opts"])) {
|
|
3292
3554
|
return false;
|
|
3555
|
+
} else if (proxy["underlying-proxy"] || proxy["dialer-proxy"]) {
|
|
3556
|
+
app_default.error(
|
|
3557
|
+
`Clash \u4E0D\u652F\u6301\u524D\u7F6E\u4EE3\u7406\u5B57\u6BB5. \u5DF2\u8FC7\u6EE4\u8282\u70B9 ${proxy.name}`
|
|
3558
|
+
);
|
|
3559
|
+
return false;
|
|
3293
3560
|
}
|
|
3294
3561
|
return true;
|
|
3295
3562
|
}).map((proxy) => {
|
|
@@ -3317,6 +3584,8 @@ function Clash_Producer() {
|
|
|
3317
3584
|
proxy["persistent-keepalive"] = proxy.keepalive;
|
|
3318
3585
|
proxy["preshared-key"] = proxy["preshared-key"] ?? proxy["pre-shared-key"];
|
|
3319
3586
|
proxy["pre-shared-key"] = proxy["preshared-key"];
|
|
3587
|
+
} else if (proxy.type === "snell" && proxy.version < 3) {
|
|
3588
|
+
delete proxy.udp;
|
|
3320
3589
|
} else if (proxy.type === "vless") {
|
|
3321
3590
|
if (isPresent2(proxy, "sni")) {
|
|
3322
3591
|
proxy.servername = proxy.sni;
|
|
@@ -3353,7 +3622,8 @@ function Clash_Producer() {
|
|
|
3353
3622
|
"tuic",
|
|
3354
3623
|
"hysteria",
|
|
3355
3624
|
"hysteria2",
|
|
3356
|
-
"juicity"
|
|
3625
|
+
"juicity",
|
|
3626
|
+
"anytls"
|
|
3357
3627
|
].includes(proxy.type)) {
|
|
3358
3628
|
delete proxy.tls;
|
|
3359
3629
|
}
|
|
@@ -3361,10 +3631,6 @@ function Clash_Producer() {
|
|
|
3361
3631
|
proxy.fingerprint = proxy["tls-fingerprint"];
|
|
3362
3632
|
}
|
|
3363
3633
|
delete proxy["tls-fingerprint"];
|
|
3364
|
-
if (proxy["underlying-proxy"]) {
|
|
3365
|
-
proxy["dialer-proxy"] = proxy["underlying-proxy"];
|
|
3366
|
-
}
|
|
3367
|
-
delete proxy["underlying-proxy"];
|
|
3368
3634
|
if (isPresent2(proxy, "tls") && typeof proxy.tls !== "boolean") {
|
|
3369
3635
|
delete proxy.tls;
|
|
3370
3636
|
}
|
|
@@ -3426,11 +3692,14 @@ function Stash_Producer() {
|
|
|
3426
3692
|
"xchacha20",
|
|
3427
3693
|
"chacha20-ietf-poly1305",
|
|
3428
3694
|
"xchacha20-ietf-poly1305",
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3695
|
+
"2022-blake3-aes-128-gcm",
|
|
3696
|
+
"2022-blake3-aes-256-gcm"
|
|
3697
|
+
].includes(proxy.cipher) || proxy.type === "snell" && String(proxy.version) === "4" || (opts["include-unsupported-proxy"] ? proxy.type === "vless" && proxy["reality-opts"] && !["xtls-rprx-vision"].includes(proxy.flow) : proxy.type === "vless" && proxy["reality-opts"])) {
|
|
3698
|
+
return false;
|
|
3699
|
+
} else if (proxy["underlying-proxy"] || proxy["dialer-proxy"]) {
|
|
3700
|
+
app_default.error(
|
|
3701
|
+
`Stash \u6682\u4E0D\u652F\u6301\u524D\u7F6E\u4EE3\u7406\u5B57\u6BB5. \u5DF2\u8FC7\u6EE4\u8282\u70B9 ${proxy.name}. \u8BF7\u4F7F\u7528 \u4EE3\u7406\u7684\u8F6C\u53D1\u94FE https://stash.wiki/proxy-protocols/proxy-groups#relay`
|
|
3702
|
+
);
|
|
3434
3703
|
return false;
|
|
3435
3704
|
}
|
|
3436
3705
|
return true;
|
|
@@ -3520,6 +3789,8 @@ function Stash_Producer() {
|
|
|
3520
3789
|
proxy["persistent-keepalive"] = proxy.keepalive;
|
|
3521
3790
|
proxy["preshared-key"] = proxy["preshared-key"] ?? proxy["pre-shared-key"];
|
|
3522
3791
|
proxy["pre-shared-key"] = proxy["preshared-key"];
|
|
3792
|
+
} else if (proxy.type === "snell" && proxy.version < 3) {
|
|
3793
|
+
delete proxy.udp;
|
|
3523
3794
|
} else if (proxy.type === "vless") {
|
|
3524
3795
|
if (isPresent2(proxy, "sni")) {
|
|
3525
3796
|
proxy.servername = proxy.sni;
|
|
@@ -3556,7 +3827,8 @@ function Stash_Producer() {
|
|
|
3556
3827
|
"tuic",
|
|
3557
3828
|
"hysteria",
|
|
3558
3829
|
"hysteria2",
|
|
3559
|
-
"juicity"
|
|
3830
|
+
"juicity",
|
|
3831
|
+
"anytls"
|
|
3560
3832
|
].includes(proxy.type)) {
|
|
3561
3833
|
delete proxy.tls;
|
|
3562
3834
|
}
|
|
@@ -3564,10 +3836,6 @@ function Stash_Producer() {
|
|
|
3564
3836
|
proxy["server-cert-fingerprint"] = proxy["tls-fingerprint"];
|
|
3565
3837
|
}
|
|
3566
3838
|
delete proxy["tls-fingerprint"];
|
|
3567
|
-
if (proxy["underlying-proxy"]) {
|
|
3568
|
-
proxy["dialer-proxy"] = proxy["underlying-proxy"];
|
|
3569
|
-
}
|
|
3570
|
-
delete proxy["underlying-proxy"];
|
|
3571
3839
|
if (isPresent2(proxy, "tls") && typeof proxy.tls !== "boolean") {
|
|
3572
3840
|
delete proxy.tls;
|
|
3573
3841
|
}
|
|
@@ -3604,19 +3872,26 @@ function Stash_Producer() {
|
|
|
3604
3872
|
|
|
3605
3873
|
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/loon.js
|
|
3606
3874
|
var targetPlatform3 = "Loon";
|
|
3875
|
+
var ipVersions2 = {
|
|
3876
|
+
dual: "dual",
|
|
3877
|
+
ipv4: "v4-only",
|
|
3878
|
+
ipv6: "v6-only",
|
|
3879
|
+
"ipv4-prefer": "prefer-v4",
|
|
3880
|
+
"ipv6-prefer": "prefer-v6"
|
|
3881
|
+
};
|
|
3607
3882
|
function Loon_Producer() {
|
|
3608
3883
|
const produce2 = (proxy, type, opts = {}) => {
|
|
3609
3884
|
switch (proxy.type) {
|
|
3610
3885
|
case "ss":
|
|
3611
|
-
return shadowsocks2(proxy
|
|
3886
|
+
return shadowsocks2(proxy);
|
|
3612
3887
|
case "ssr":
|
|
3613
3888
|
return shadowsocksr(proxy);
|
|
3614
3889
|
case "trojan":
|
|
3615
3890
|
return trojan2(proxy);
|
|
3616
3891
|
case "vmess":
|
|
3617
|
-
return vmess2(proxy);
|
|
3892
|
+
return vmess2(proxy, opts["include-unsupported-proxy"]);
|
|
3618
3893
|
case "vless":
|
|
3619
|
-
return vless(proxy);
|
|
3894
|
+
return vless(proxy, opts["include-unsupported-proxy"]);
|
|
3620
3895
|
case "http":
|
|
3621
3896
|
return http2(proxy);
|
|
3622
3897
|
case "socks5":
|
|
@@ -3632,7 +3907,7 @@ function Loon_Producer() {
|
|
|
3632
3907
|
};
|
|
3633
3908
|
return { produce: produce2 };
|
|
3634
3909
|
}
|
|
3635
|
-
function shadowsocks2(proxy
|
|
3910
|
+
function shadowsocks2(proxy) {
|
|
3636
3911
|
const result = new Result(proxy);
|
|
3637
3912
|
if (![
|
|
3638
3913
|
"rc4",
|
|
@@ -3655,7 +3930,8 @@ function shadowsocks2(proxy, includeUnsupportedProxy) {
|
|
|
3655
3930
|
"aes-256-gcm",
|
|
3656
3931
|
"chacha20-ietf-poly1305",
|
|
3657
3932
|
"xchacha20-ietf-poly1305",
|
|
3658
|
-
|
|
3933
|
+
"2022-blake3-aes-128-gcm",
|
|
3934
|
+
"2022-blake3-aes-256-gcm"
|
|
3659
3935
|
].includes(proxy.cipher)) {
|
|
3660
3936
|
throw new Error(`cipher ${proxy.cipher} is not supported`);
|
|
3661
3937
|
}
|
|
@@ -3673,14 +3949,55 @@ function shadowsocks2(proxy, includeUnsupportedProxy) {
|
|
|
3673
3949
|
`,obfs-uri=${proxy["plugin-opts"].path}`,
|
|
3674
3950
|
"plugin-opts.path"
|
|
3675
3951
|
);
|
|
3676
|
-
} else {
|
|
3952
|
+
} else if (!["shadow-tls"].includes(proxy.plugin)) {
|
|
3677
3953
|
throw new Error(`plugin ${proxy.plugin} is not supported`);
|
|
3678
3954
|
}
|
|
3679
3955
|
}
|
|
3956
|
+
if (isPresent2(proxy, "shadow-tls-password")) {
|
|
3957
|
+
result.append(`,shadow-tls-password=${proxy["shadow-tls-password"]}`);
|
|
3958
|
+
result.appendIfPresent(
|
|
3959
|
+
`,shadow-tls-version=${proxy["shadow-tls-version"]}`,
|
|
3960
|
+
"shadow-tls-version"
|
|
3961
|
+
);
|
|
3962
|
+
result.appendIfPresent(
|
|
3963
|
+
`,shadow-tls-sni=${proxy["shadow-tls-sni"]}`,
|
|
3964
|
+
"shadow-tls-sni"
|
|
3965
|
+
);
|
|
3966
|
+
result.appendIfPresent(`,udp-port=${proxy["udp-port"]}`, "udp-port");
|
|
3967
|
+
} else if (["shadow-tls"].includes(proxy.plugin) && proxy["plugin-opts"]) {
|
|
3968
|
+
const password = proxy["plugin-opts"].password;
|
|
3969
|
+
const host = proxy["plugin-opts"].host;
|
|
3970
|
+
const version = proxy["plugin-opts"].version;
|
|
3971
|
+
if (password) {
|
|
3972
|
+
result.append(`,shadow-tls-password=${password}`);
|
|
3973
|
+
if (host) {
|
|
3974
|
+
result.append(`,shadow-tls-sni=${host}`);
|
|
3975
|
+
}
|
|
3976
|
+
if (version) {
|
|
3977
|
+
if (version < 2) {
|
|
3978
|
+
throw new Error(
|
|
3979
|
+
`shadow-tls version ${version} is not supported`
|
|
3980
|
+
);
|
|
3981
|
+
}
|
|
3982
|
+
result.append(`,shadow-tls-version=${version}`);
|
|
3983
|
+
}
|
|
3984
|
+
result.appendIfPresent(
|
|
3985
|
+
`,udp-port=${proxy["udp-port"]}`,
|
|
3986
|
+
"udp-port"
|
|
3987
|
+
);
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3680
3990
|
result.appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
3991
|
+
if (proxy["block-quic"] === "on") {
|
|
3992
|
+
result.append(",block-quic=true");
|
|
3993
|
+
} else if (proxy["block-quic"] === "off") {
|
|
3994
|
+
result.append(",block-quic=false");
|
|
3995
|
+
}
|
|
3681
3996
|
if (proxy.udp) {
|
|
3682
3997
|
result.append(`,udp=true`);
|
|
3683
3998
|
}
|
|
3999
|
+
const ip_version = ipVersions2[proxy["ip-version"]] || proxy["ip-version"];
|
|
4000
|
+
result.appendIfPresent(`,ip-mode=${ip_version}`, "ip-version");
|
|
3684
4001
|
return result.toString();
|
|
3685
4002
|
}
|
|
3686
4003
|
function shadowsocksr(proxy) {
|
|
@@ -3695,10 +4012,51 @@ function shadowsocksr(proxy) {
|
|
|
3695
4012
|
);
|
|
3696
4013
|
result.appendIfPresent(`,obfs=${proxy.obfs}`, "obfs");
|
|
3697
4014
|
result.appendIfPresent(`,obfs-param=${proxy["obfs-param"]}`, "obfs-param");
|
|
4015
|
+
if (isPresent2(proxy, "shadow-tls-password")) {
|
|
4016
|
+
result.append(`,shadow-tls-password=${proxy["shadow-tls-password"]}`);
|
|
4017
|
+
result.appendIfPresent(
|
|
4018
|
+
`,shadow-tls-version=${proxy["shadow-tls-version"]}`,
|
|
4019
|
+
"shadow-tls-version"
|
|
4020
|
+
);
|
|
4021
|
+
result.appendIfPresent(
|
|
4022
|
+
`,shadow-tls-sni=${proxy["shadow-tls-sni"]}`,
|
|
4023
|
+
"shadow-tls-sni"
|
|
4024
|
+
);
|
|
4025
|
+
result.appendIfPresent(`,udp-port=${proxy["udp-port"]}`, "udp-port");
|
|
4026
|
+
} else if (["shadow-tls"].includes(proxy.plugin) && proxy["plugin-opts"]) {
|
|
4027
|
+
const password = proxy["plugin-opts"].password;
|
|
4028
|
+
const host = proxy["plugin-opts"].host;
|
|
4029
|
+
const version = proxy["plugin-opts"].version;
|
|
4030
|
+
if (password) {
|
|
4031
|
+
result.append(`,shadow-tls-password=${password}`);
|
|
4032
|
+
if (host) {
|
|
4033
|
+
result.append(`,shadow-tls-sni=${host}`);
|
|
4034
|
+
}
|
|
4035
|
+
if (version) {
|
|
4036
|
+
if (version < 2) {
|
|
4037
|
+
throw new Error(
|
|
4038
|
+
`shadow-tls version ${version} is not supported`
|
|
4039
|
+
);
|
|
4040
|
+
}
|
|
4041
|
+
result.append(`,shadow-tls-version=${version}`);
|
|
4042
|
+
}
|
|
4043
|
+
result.appendIfPresent(
|
|
4044
|
+
`,udp-port=${proxy["udp-port"]}`,
|
|
4045
|
+
"udp-port"
|
|
4046
|
+
);
|
|
4047
|
+
}
|
|
4048
|
+
}
|
|
3698
4049
|
result.appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
4050
|
+
if (proxy["block-quic"] === "on") {
|
|
4051
|
+
result.append(",block-quic=true");
|
|
4052
|
+
} else if (proxy["block-quic"] === "off") {
|
|
4053
|
+
result.append(",block-quic=false");
|
|
4054
|
+
}
|
|
3699
4055
|
if (proxy.udp) {
|
|
3700
4056
|
result.append(`,udp=true`);
|
|
3701
4057
|
}
|
|
4058
|
+
const ip_version = ipVersions2[proxy["ip-version"]] || proxy["ip-version"];
|
|
4059
|
+
result.appendIfPresent(`,ip-mode=${ip_version}`, "ip-version");
|
|
3702
4060
|
return result.toString();
|
|
3703
4061
|
}
|
|
3704
4062
|
function trojan2(proxy) {
|
|
@@ -3738,12 +4096,20 @@ function trojan2(proxy) {
|
|
|
3738
4096
|
"tls-pubkey-sha256"
|
|
3739
4097
|
);
|
|
3740
4098
|
result.appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
4099
|
+
if (proxy["block-quic"] === "on") {
|
|
4100
|
+
result.append(",block-quic=true");
|
|
4101
|
+
} else if (proxy["block-quic"] === "off") {
|
|
4102
|
+
result.append(",block-quic=false");
|
|
4103
|
+
}
|
|
3741
4104
|
if (proxy.udp) {
|
|
3742
4105
|
result.append(`,udp=true`);
|
|
3743
4106
|
}
|
|
4107
|
+
const ip_version = ipVersions2[proxy["ip-version"]] || proxy["ip-version"];
|
|
4108
|
+
result.appendIfPresent(`,ip-mode=${ip_version}`, "ip-version");
|
|
3744
4109
|
return result.toString();
|
|
3745
4110
|
}
|
|
3746
4111
|
function vmess2(proxy) {
|
|
4112
|
+
const isReality = !!proxy["reality-opts"];
|
|
3747
4113
|
const result = new Result(proxy);
|
|
3748
4114
|
result.append(
|
|
3749
4115
|
`${proxy.name}=vmess,${proxy.server},${proxy.port},${proxy.cipher},"${proxy.uuid}"`
|
|
@@ -3785,29 +4151,54 @@ function vmess2(proxy) {
|
|
|
3785
4151
|
`,skip-cert-verify=${proxy["skip-cert-verify"]}`,
|
|
3786
4152
|
"skip-cert-verify"
|
|
3787
4153
|
);
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
4154
|
+
if (isReality) {
|
|
4155
|
+
result.appendIfPresent(`,sni=${proxy.sni}`, "sni");
|
|
4156
|
+
result.appendIfPresent(
|
|
4157
|
+
`,public-key="${proxy["reality-opts"]["public-key"]}"`,
|
|
4158
|
+
"reality-opts.public-key"
|
|
4159
|
+
);
|
|
4160
|
+
result.appendIfPresent(
|
|
4161
|
+
`,short-id=${proxy["reality-opts"]["short-id"]}`,
|
|
4162
|
+
"reality-opts.short-id"
|
|
4163
|
+
);
|
|
4164
|
+
} else {
|
|
4165
|
+
result.appendIfPresent(`,tls-name=${proxy.sni}`, "sni");
|
|
4166
|
+
result.appendIfPresent(
|
|
4167
|
+
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
4168
|
+
"tls-fingerprint"
|
|
4169
|
+
);
|
|
4170
|
+
result.appendIfPresent(
|
|
4171
|
+
`,tls-pubkey-sha256=${proxy["tls-pubkey-sha256"]}`,
|
|
4172
|
+
"tls-pubkey-sha256"
|
|
4173
|
+
);
|
|
4174
|
+
}
|
|
3797
4175
|
if (isPresent2(proxy, "aead")) {
|
|
3798
4176
|
result.append(`,alterId=0`);
|
|
3799
4177
|
} else {
|
|
3800
4178
|
result.append(`,alterId=${proxy.alterId}`);
|
|
3801
4179
|
}
|
|
3802
4180
|
result.appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
4181
|
+
if (proxy["block-quic"] === "on") {
|
|
4182
|
+
result.append(",block-quic=true");
|
|
4183
|
+
} else if (proxy["block-quic"] === "off") {
|
|
4184
|
+
result.append(",block-quic=false");
|
|
4185
|
+
}
|
|
3803
4186
|
if (proxy.udp) {
|
|
3804
4187
|
result.append(`,udp=true`);
|
|
3805
4188
|
}
|
|
4189
|
+
const ip_version = ipVersions2[proxy["ip-version"]] || proxy["ip-version"];
|
|
4190
|
+
result.appendIfPresent(`,ip-mode=${ip_version}`, "ip-version");
|
|
3806
4191
|
return result.toString();
|
|
3807
4192
|
}
|
|
3808
4193
|
function vless(proxy) {
|
|
3809
|
-
|
|
3810
|
-
|
|
4194
|
+
let isXtls = false;
|
|
4195
|
+
const isReality = !!proxy["reality-opts"];
|
|
4196
|
+
if (typeof proxy.flow !== "undefined") {
|
|
4197
|
+
if (["xtls-rprx-vision"].includes(proxy.flow)) {
|
|
4198
|
+
isXtls = true;
|
|
4199
|
+
} else {
|
|
4200
|
+
throw new Error(`VLESS flow(${proxy.flow}) is not supported`);
|
|
4201
|
+
}
|
|
3811
4202
|
}
|
|
3812
4203
|
const result = new Result(proxy);
|
|
3813
4204
|
result.append(
|
|
@@ -3850,19 +4241,41 @@ function vless(proxy) {
|
|
|
3850
4241
|
`,skip-cert-verify=${proxy["skip-cert-verify"]}`,
|
|
3851
4242
|
"skip-cert-verify"
|
|
3852
4243
|
);
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
4244
|
+
if (isXtls) {
|
|
4245
|
+
result.appendIfPresent(`,flow=${proxy.flow}`, "flow");
|
|
4246
|
+
}
|
|
4247
|
+
if (isReality) {
|
|
4248
|
+
result.appendIfPresent(`,sni=${proxy.sni}`, "sni");
|
|
4249
|
+
result.appendIfPresent(
|
|
4250
|
+
`,public-key="${proxy["reality-opts"]["public-key"]}"`,
|
|
4251
|
+
"reality-opts.public-key"
|
|
4252
|
+
);
|
|
4253
|
+
result.appendIfPresent(
|
|
4254
|
+
`,short-id=${proxy["reality-opts"]["short-id"]}`,
|
|
4255
|
+
"reality-opts.short-id"
|
|
4256
|
+
);
|
|
4257
|
+
} else {
|
|
4258
|
+
result.appendIfPresent(`,tls-name=${proxy.sni}`, "sni");
|
|
4259
|
+
result.appendIfPresent(
|
|
4260
|
+
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
4261
|
+
"tls-fingerprint"
|
|
4262
|
+
);
|
|
4263
|
+
result.appendIfPresent(
|
|
4264
|
+
`,tls-pubkey-sha256=${proxy["tls-pubkey-sha256"]}`,
|
|
4265
|
+
"tls-pubkey-sha256"
|
|
4266
|
+
);
|
|
4267
|
+
}
|
|
3862
4268
|
result.appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
4269
|
+
if (proxy["block-quic"] === "on") {
|
|
4270
|
+
result.append(",block-quic=true");
|
|
4271
|
+
} else if (proxy["block-quic"] === "off") {
|
|
4272
|
+
result.append(",block-quic=false");
|
|
4273
|
+
}
|
|
3863
4274
|
if (proxy.udp) {
|
|
3864
4275
|
result.append(`,udp=true`);
|
|
3865
4276
|
}
|
|
4277
|
+
const ip_version = ipVersions2[proxy["ip-version"]] || proxy["ip-version"];
|
|
4278
|
+
result.appendIfPresent(`,ip-mode=${ip_version}`, "ip-version");
|
|
3866
4279
|
return result.toString();
|
|
3867
4280
|
}
|
|
3868
4281
|
function http2(proxy) {
|
|
@@ -3877,6 +4290,13 @@ function http2(proxy) {
|
|
|
3877
4290
|
"skip-cert-verify"
|
|
3878
4291
|
);
|
|
3879
4292
|
result.appendIfPresent(`,tfo=${proxy.tfo}`, "tfo");
|
|
4293
|
+
if (proxy["block-quic"] === "on") {
|
|
4294
|
+
result.append(",block-quic=true");
|
|
4295
|
+
} else if (proxy["block-quic"] === "off") {
|
|
4296
|
+
result.append(",block-quic=false");
|
|
4297
|
+
}
|
|
4298
|
+
const ip_version = ipVersions2[proxy["ip-version"]] || proxy["ip-version"];
|
|
4299
|
+
result.appendIfPresent(`,ip-mode=${ip_version}`, "ip-version");
|
|
3880
4300
|
return result.toString();
|
|
3881
4301
|
}
|
|
3882
4302
|
function socks52(proxy) {
|
|
@@ -3891,9 +4311,16 @@ function socks52(proxy) {
|
|
|
3891
4311
|
"skip-cert-verify"
|
|
3892
4312
|
);
|
|
3893
4313
|
result.appendIfPresent(`,tfo=${proxy.tfo}`, "tfo");
|
|
4314
|
+
if (proxy["block-quic"] === "on") {
|
|
4315
|
+
result.append(",block-quic=true");
|
|
4316
|
+
} else if (proxy["block-quic"] === "off") {
|
|
4317
|
+
result.append(",block-quic=false");
|
|
4318
|
+
}
|
|
3894
4319
|
if (proxy.udp) {
|
|
3895
4320
|
result.append(`,udp=true`);
|
|
3896
4321
|
}
|
|
4322
|
+
const ip_version = ipVersions2[proxy["ip-version"]] || proxy["ip-version"];
|
|
4323
|
+
result.appendIfPresent(`,ip-mode=${ip_version}`, "ip-version");
|
|
3897
4324
|
return result.toString();
|
|
3898
4325
|
}
|
|
3899
4326
|
function wireguard2(proxy) {
|
|
@@ -3945,6 +4372,13 @@ function wireguard2(proxy) {
|
|
|
3945
4372
|
result.append(
|
|
3946
4373
|
`,peers=[{public-key="${proxy["public-key"]}",allowed-ips="${allowedIps ?? "0.0.0.0/0,::/0"}",endpoint=${proxy.server}:${proxy.port}${reserved ?? ""}${presharedKey ?? ""}}]`
|
|
3947
4374
|
);
|
|
4375
|
+
const ip_version = ipVersions2[proxy["ip-version"]] || proxy["ip-version"];
|
|
4376
|
+
result.appendIfPresent(`,ip-mode=${ip_version}`, "ip-version");
|
|
4377
|
+
if (proxy["block-quic"] === "on") {
|
|
4378
|
+
result.append(",block-quic=true");
|
|
4379
|
+
} else if (proxy["block-quic"] === "off") {
|
|
4380
|
+
result.append(",block-quic=false");
|
|
4381
|
+
}
|
|
3948
4382
|
return result.toString();
|
|
3949
4383
|
}
|
|
3950
4384
|
function hysteria22(proxy) {
|
|
@@ -3971,6 +4405,11 @@ function hysteria22(proxy) {
|
|
|
3971
4405
|
result.append(`,salamander-password=${proxy["obfs-password"]}`);
|
|
3972
4406
|
}
|
|
3973
4407
|
result.appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
4408
|
+
if (proxy["block-quic"] === "on") {
|
|
4409
|
+
result.append(",block-quic=true");
|
|
4410
|
+
} else if (proxy["block-quic"] === "off") {
|
|
4411
|
+
result.append(",block-quic=false");
|
|
4412
|
+
}
|
|
3974
4413
|
if (proxy.udp) {
|
|
3975
4414
|
result.append(`,udp=true`);
|
|
3976
4415
|
}
|
|
@@ -3979,6 +4418,8 @@ function hysteria22(proxy) {
|
|
|
3979
4418
|
"down"
|
|
3980
4419
|
);
|
|
3981
4420
|
result.appendIfPresent(`,ecn=${proxy.ecn}`, "ecn");
|
|
4421
|
+
const ip_version = ipVersions2[proxy["ip-version"]] || proxy["ip-version"];
|
|
4422
|
+
result.appendIfPresent(`,ip-mode=${ip_version}`, "ip-version");
|
|
3982
4423
|
return result.toString();
|
|
3983
4424
|
}
|
|
3984
4425
|
|
|
@@ -3994,7 +4435,7 @@ function URI_Producer() {
|
|
|
3994
4435
|
delete proxy.resolved;
|
|
3995
4436
|
delete proxy["no-resolve"];
|
|
3996
4437
|
for (const key in proxy) {
|
|
3997
|
-
if (proxy[key] == null
|
|
4438
|
+
if (proxy[key] == null) {
|
|
3998
4439
|
delete proxy[key];
|
|
3999
4440
|
}
|
|
4000
4441
|
}
|
|
@@ -4003,10 +4444,15 @@ function URI_Producer() {
|
|
|
4003
4444
|
)) {
|
|
4004
4445
|
delete proxy.tls;
|
|
4005
4446
|
}
|
|
4006
|
-
if (proxy.server && isIPv6(proxy.server)) {
|
|
4447
|
+
if (!["vmess"].includes(proxy.type) && proxy.server && isIPv6(proxy.server)) {
|
|
4007
4448
|
proxy.server = `[${proxy.server}]`;
|
|
4008
4449
|
}
|
|
4009
4450
|
switch (proxy.type) {
|
|
4451
|
+
case "socks5":
|
|
4452
|
+
result = `socks://${encodeURIComponent(
|
|
4453
|
+
Base643.encode(`${proxy.username}:${proxy.password}`)
|
|
4454
|
+
)}@${proxy.server}:${proxy.port}#${proxy.name}`;
|
|
4455
|
+
break;
|
|
4010
4456
|
case "ss":
|
|
4011
4457
|
const userinfo = `${proxy.cipher}:${proxy.password}`;
|
|
4012
4458
|
result = `ss://${proxy.cipher?.startsWith("2022-blake3-") ? `${encodeURIComponent(
|
|
@@ -4026,6 +4472,11 @@ function URI_Producer() {
|
|
|
4026
4472
|
`v2ray-plugin;obfs=${opts.mode}${opts.host ? ";obfs-host" + opts.host : ""}${opts.tls ? ";tls" : ""}`
|
|
4027
4473
|
);
|
|
4028
4474
|
break;
|
|
4475
|
+
case "shadow-tls":
|
|
4476
|
+
result += encodeURIComponent(
|
|
4477
|
+
`shadow-tls;host=${opts.host};password=${opts.password};version=${opts.version}`
|
|
4478
|
+
);
|
|
4479
|
+
break;
|
|
4029
4480
|
default:
|
|
4030
4481
|
throw new Error(
|
|
4031
4482
|
`Unsupported plugin option: ${proxy.plugin}`
|
|
@@ -4090,6 +4541,7 @@ function URI_Producer() {
|
|
|
4090
4541
|
const isReality = proxy["reality-opts"];
|
|
4091
4542
|
let sid = "";
|
|
4092
4543
|
let pbk = "";
|
|
4544
|
+
let spx = "";
|
|
4093
4545
|
if (isReality) {
|
|
4094
4546
|
security = "reality";
|
|
4095
4547
|
const publicKey = proxy["reality-opts"]?.["public-key"];
|
|
@@ -4100,6 +4552,10 @@ function URI_Producer() {
|
|
|
4100
4552
|
if (shortId) {
|
|
4101
4553
|
sid = `&sid=${encodeURIComponent(shortId)}`;
|
|
4102
4554
|
}
|
|
4555
|
+
const spiderX = proxy["reality-opts"]?.["_spider-x"];
|
|
4556
|
+
if (spiderX) {
|
|
4557
|
+
spx = `&spx=${encodeURIComponent(spiderX)}`;
|
|
4558
|
+
}
|
|
4103
4559
|
} else if (proxy.tls) {
|
|
4104
4560
|
security = "tls";
|
|
4105
4561
|
}
|
|
@@ -4127,6 +4583,14 @@ function URI_Producer() {
|
|
|
4127
4583
|
if (proxy.flow) {
|
|
4128
4584
|
flow = `&flow=${encodeURIComponent(proxy.flow)}`;
|
|
4129
4585
|
}
|
|
4586
|
+
let extra = "";
|
|
4587
|
+
if (proxy._extra) {
|
|
4588
|
+
extra = `&extra=${encodeURIComponent(proxy._extra)}`;
|
|
4589
|
+
}
|
|
4590
|
+
let mode = "";
|
|
4591
|
+
if (proxy._mode) {
|
|
4592
|
+
mode = `&mode=${encodeURIComponent(proxy._mode)}`;
|
|
4593
|
+
}
|
|
4130
4594
|
let vlessType = proxy.network;
|
|
4131
4595
|
if (proxy.network === "ws" && proxy["ws-opts"]?.["v2ray-http-upgrade"]) {
|
|
4132
4596
|
vlessType = "httpupgrade";
|
|
@@ -4175,7 +4639,7 @@ function URI_Producer() {
|
|
|
4175
4639
|
}
|
|
4176
4640
|
result = `vless://${proxy.uuid}@${proxy.server}:${proxy.port}?security=${encodeURIComponent(
|
|
4177
4641
|
security
|
|
4178
|
-
)}${vlessTransport}${alpn}${allowInsecure}${sni}${fp}${flow}${sid}${pbk}#${encodeURIComponent(
|
|
4642
|
+
)}${vlessTransport}${alpn}${allowInsecure}${sni}${fp}${flow}${sid}${spx}${pbk}${mode}${extra}#${encodeURIComponent(
|
|
4179
4643
|
proxy.name
|
|
4180
4644
|
)}`;
|
|
4181
4645
|
break;
|
|
@@ -4229,12 +4693,50 @@ function URI_Producer() {
|
|
|
4229
4693
|
Array.isArray(proxy.alpn) ? proxy.alpn : proxy.alpn.join(",")
|
|
4230
4694
|
)}`;
|
|
4231
4695
|
}
|
|
4232
|
-
|
|
4696
|
+
const trojanIsReality = proxy["reality-opts"];
|
|
4697
|
+
let trojanSid = "";
|
|
4698
|
+
let trojanPbk = "";
|
|
4699
|
+
let trojanSpx = "";
|
|
4700
|
+
let trojanSecurity = "";
|
|
4701
|
+
let trojanMode = "";
|
|
4702
|
+
let trojanExtra = "";
|
|
4703
|
+
if (trojanIsReality) {
|
|
4704
|
+
trojanSecurity = `&security=reality`;
|
|
4705
|
+
const publicKey = proxy["reality-opts"]?.["public-key"];
|
|
4706
|
+
if (publicKey) {
|
|
4707
|
+
trojanPbk = `&pbk=${encodeURIComponent(publicKey)}`;
|
|
4708
|
+
}
|
|
4709
|
+
const shortId = proxy["reality-opts"]?.["short-id"];
|
|
4710
|
+
if (shortId) {
|
|
4711
|
+
trojanSid = `&sid=${encodeURIComponent(shortId)}`;
|
|
4712
|
+
}
|
|
4713
|
+
const spiderX = proxy["reality-opts"]?.["_spider-x"];
|
|
4714
|
+
if (spiderX) {
|
|
4715
|
+
trojanSpx = `&spx=${encodeURIComponent(spiderX)}`;
|
|
4716
|
+
}
|
|
4717
|
+
if (proxy._extra) {
|
|
4718
|
+
trojanExtra = `&extra=${encodeURIComponent(
|
|
4719
|
+
proxy._extra
|
|
4720
|
+
)}`;
|
|
4721
|
+
}
|
|
4722
|
+
if (proxy._mode) {
|
|
4723
|
+
trojanMode = `&mode=${encodeURIComponent(proxy._mode)}`;
|
|
4724
|
+
}
|
|
4725
|
+
}
|
|
4726
|
+
result = `trojan://${proxy.password}@${proxy.server}:${proxy.port}?sni=${encodeURIComponent(proxy.sni || proxy.server)}${proxy["skip-cert-verify"] ? "&allowInsecure=1" : ""}${trojanTransport}${trojanAlpn}${trojanFp}${trojanSecurity}${trojanSid}${trojanPbk}${trojanSpx}${trojanMode}${trojanExtra}#${encodeURIComponent(
|
|
4233
4727
|
proxy.name
|
|
4234
4728
|
)}`;
|
|
4235
4729
|
break;
|
|
4236
4730
|
case "hysteria2":
|
|
4237
4731
|
let hysteria2params = [];
|
|
4732
|
+
if (proxy["hop-interval"]) {
|
|
4733
|
+
hysteria2params.push(
|
|
4734
|
+
`hop-interval=${proxy["hop-interval"]}`
|
|
4735
|
+
);
|
|
4736
|
+
}
|
|
4737
|
+
if (proxy["keepalive"]) {
|
|
4738
|
+
hysteria2params.push(`keepalive=${proxy["keepalive"]}`);
|
|
4739
|
+
}
|
|
4238
4740
|
if (proxy["skip-cert-verify"]) {
|
|
4239
4741
|
hysteria2params.push(`insecure=1`);
|
|
4240
4742
|
}
|
|
@@ -4307,7 +4809,7 @@ function URI_Producer() {
|
|
|
4307
4809
|
hysteriaParams.push(`obfsParam=${proxy[key]}`);
|
|
4308
4810
|
} else if (["sni"].includes(key)) {
|
|
4309
4811
|
hysteriaParams.push(`peer=${proxy[key]}`);
|
|
4310
|
-
} else if (proxy[key]) {
|
|
4812
|
+
} else if (proxy[key] && !/^_/i.test(key)) {
|
|
4311
4813
|
hysteriaParams.push(
|
|
4312
4814
|
`${i}=${encodeURIComponent(proxy[key])}`
|
|
4313
4815
|
);
|
|
@@ -4328,7 +4830,8 @@ function URI_Producer() {
|
|
|
4328
4830
|
"uuid",
|
|
4329
4831
|
"password",
|
|
4330
4832
|
"server",
|
|
4331
|
-
"port"
|
|
4833
|
+
"port",
|
|
4834
|
+
"tls"
|
|
4332
4835
|
].includes(key)) {
|
|
4333
4836
|
const i = key.replace(/-/, "_");
|
|
4334
4837
|
if (["alpn"].includes(key)) {
|
|
@@ -4348,10 +4851,17 @@ function URI_Producer() {
|
|
|
4348
4851
|
tuicParams.push(`fast_open=1`);
|
|
4349
4852
|
}
|
|
4350
4853
|
} else if (["disable-sni", "reduce-rtt"].includes(key) && proxy[key]) {
|
|
4351
|
-
tuicParams.push(`${i}=1`);
|
|
4352
|
-
} else if (
|
|
4854
|
+
tuicParams.push(`${i.replace(/-/g, "_")}=1`);
|
|
4855
|
+
} else if (["congestion-controller"].includes(key)) {
|
|
4856
|
+
tuicParams.push(
|
|
4857
|
+
`congestion_control=${proxy[key]}`
|
|
4858
|
+
);
|
|
4859
|
+
} else if (proxy[key] && !/^_/i.test(key)) {
|
|
4353
4860
|
tuicParams.push(
|
|
4354
|
-
`${i
|
|
4861
|
+
`${i.replace(
|
|
4862
|
+
/-/g,
|
|
4863
|
+
"_"
|
|
4864
|
+
)}=${encodeURIComponent(proxy[key])}`
|
|
4355
4865
|
);
|
|
4356
4866
|
}
|
|
4357
4867
|
}
|
|
@@ -4363,6 +4873,47 @@ function URI_Producer() {
|
|
|
4363
4873
|
)}`;
|
|
4364
4874
|
}
|
|
4365
4875
|
break;
|
|
4876
|
+
case "anytls":
|
|
4877
|
+
let anytlsParams = [];
|
|
4878
|
+
Object.keys(proxy).forEach((key) => {
|
|
4879
|
+
if (![
|
|
4880
|
+
"name",
|
|
4881
|
+
"type",
|
|
4882
|
+
"password",
|
|
4883
|
+
"server",
|
|
4884
|
+
"port",
|
|
4885
|
+
"tls"
|
|
4886
|
+
].includes(key)) {
|
|
4887
|
+
const i = key.replace(/-/, "_");
|
|
4888
|
+
if (["alpn"].includes(key)) {
|
|
4889
|
+
if (proxy[key]) {
|
|
4890
|
+
anytlsParams.push(
|
|
4891
|
+
`${i}=${encodeURIComponent(
|
|
4892
|
+
Array.isArray(proxy[key]) ? proxy[key][0] : proxy[key]
|
|
4893
|
+
)}`
|
|
4894
|
+
);
|
|
4895
|
+
}
|
|
4896
|
+
} else if (["skip-cert-verify"].includes(key)) {
|
|
4897
|
+
if (proxy[key]) {
|
|
4898
|
+
anytlsParams.push(`insecure=1`);
|
|
4899
|
+
}
|
|
4900
|
+
} else if (["udp"].includes(key)) {
|
|
4901
|
+
if (proxy[key]) {
|
|
4902
|
+
anytlsParams.push(`udp=1`);
|
|
4903
|
+
}
|
|
4904
|
+
} else if (proxy[key] && !/^_/i.test(key)) {
|
|
4905
|
+
anytlsParams.push(
|
|
4906
|
+
`${i.replace(/-/g, "_")}=${encodeURIComponent(
|
|
4907
|
+
proxy[key]
|
|
4908
|
+
)}`
|
|
4909
|
+
);
|
|
4910
|
+
}
|
|
4911
|
+
}
|
|
4912
|
+
});
|
|
4913
|
+
result = `anytls://${encodeURIComponent(proxy.password)}@${proxy.server}:${proxy.port}/?${anytlsParams.join("&")}#${encodeURIComponent(
|
|
4914
|
+
proxy.name
|
|
4915
|
+
)}`;
|
|
4916
|
+
break;
|
|
4366
4917
|
case "wireguard":
|
|
4367
4918
|
let wireguardParams = [];
|
|
4368
4919
|
Object.keys(proxy).forEach((key) => {
|
|
@@ -4381,7 +4932,7 @@ function URI_Producer() {
|
|
|
4381
4932
|
if (proxy[key]) {
|
|
4382
4933
|
wireguardParams.push(`${key}=1`);
|
|
4383
4934
|
}
|
|
4384
|
-
} else if (proxy[key]) {
|
|
4935
|
+
} else if (proxy[key] && !/^_/i.test(key)) {
|
|
4385
4936
|
wireguardParams.push(
|
|
4386
4937
|
`${key}=${encodeURIComponent(proxy[key])}`
|
|
4387
4938
|
);
|
|
@@ -4441,7 +4992,7 @@ function QX_Producer() {
|
|
|
4441
4992
|
const produce2 = (proxy, type, opts = {}) => {
|
|
4442
4993
|
switch (proxy.type) {
|
|
4443
4994
|
case "ss":
|
|
4444
|
-
return shadowsocks3(proxy);
|
|
4995
|
+
return shadowsocks3(proxy, opts["include-unsupported-proxy"]);
|
|
4445
4996
|
case "ssr":
|
|
4446
4997
|
return shadowsocksr2(proxy);
|
|
4447
4998
|
case "trojan":
|
|
@@ -4461,7 +5012,7 @@ function QX_Producer() {
|
|
|
4461
5012
|
};
|
|
4462
5013
|
return { produce: produce2 };
|
|
4463
5014
|
}
|
|
4464
|
-
function shadowsocks3(proxy) {
|
|
5015
|
+
function shadowsocks3(proxy, includeUnsupportedProxy) {
|
|
4465
5016
|
const result = new Result(proxy);
|
|
4466
5017
|
const append = result.append.bind(result);
|
|
4467
5018
|
const appendIfPresent = result.appendIfPresent.bind(result);
|
|
@@ -4489,7 +5040,8 @@ function shadowsocks3(proxy) {
|
|
|
4489
5040
|
"aes-192-gcm",
|
|
4490
5041
|
"aes-256-gcm",
|
|
4491
5042
|
"chacha20-ietf-poly1305",
|
|
4492
|
-
"xchacha20-ietf-poly1305"
|
|
5043
|
+
"xchacha20-ietf-poly1305",
|
|
5044
|
+
...includeUnsupportedProxy ? ["2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm"] : []
|
|
4493
5045
|
].includes(proxy.cipher)) {
|
|
4494
5046
|
throw new Error(`cipher ${proxy.cipher} is not supported`);
|
|
4495
5047
|
}
|
|
@@ -4545,6 +5097,15 @@ function shadowsocks3(proxy) {
|
|
|
4545
5097
|
}
|
|
4546
5098
|
appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
4547
5099
|
appendIfPresent(`,udp-relay=${proxy.udp}`, "udp");
|
|
5100
|
+
if (proxy["_ssr_python_uot"]) {
|
|
5101
|
+
append(`,udp-over-tcp=true`);
|
|
5102
|
+
} else if (proxy["udp-over-tcp"]) {
|
|
5103
|
+
if (!proxy["udp-over-tcp-version"] || proxy["udp-over-tcp-version"] === 1) {
|
|
5104
|
+
append(`,udp-over-tcp=sp.v1`);
|
|
5105
|
+
} else if (proxy["udp-over-tcp-version"] === 2) {
|
|
5106
|
+
append(`,udp-over-tcp=sp.v2`);
|
|
5107
|
+
}
|
|
5108
|
+
}
|
|
4548
5109
|
result.appendIfPresent(
|
|
4549
5110
|
`,server_check_url=${proxy["test-url"]}`,
|
|
4550
5111
|
"test-url"
|
|
@@ -4871,14 +5432,19 @@ function needTls(proxy) {
|
|
|
4871
5432
|
}
|
|
4872
5433
|
|
|
4873
5434
|
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/shadowrocket.js
|
|
4874
|
-
function
|
|
5435
|
+
function Shadowrocket_Producer() {
|
|
4875
5436
|
const type = "ALL";
|
|
4876
5437
|
const produce2 = (proxies, type2, opts = {}) => {
|
|
4877
5438
|
const list = proxies.filter((proxy) => {
|
|
4878
5439
|
if (opts["include-unsupported-proxy"]) return true;
|
|
4879
5440
|
if (proxy.type === "snell" && String(proxy.version) === "4") {
|
|
4880
5441
|
return false;
|
|
4881
|
-
} else if (["mieru"].includes(proxy.type)) {
|
|
5442
|
+
} else if (["mieru", "anytls"].includes(proxy.type)) {
|
|
5443
|
+
return false;
|
|
5444
|
+
} else if (proxy["underlying-proxy"] || proxy["dialer-proxy"]) {
|
|
5445
|
+
app_default.error(
|
|
5446
|
+
`Shadowrocket \u4E0D\u652F\u6301\u524D\u7F6E\u4EE3\u7406\u5B57\u6BB5. \u5DF2\u8FC7\u6EE4\u8282\u70B9 ${proxy.name}. \u8BF7\u4F7F\u7528 App \u5185\u7684 "\u4EE3\u7406\u901A\u8FC7" \u529F\u80FD`
|
|
5447
|
+
);
|
|
4882
5448
|
return false;
|
|
4883
5449
|
}
|
|
4884
5450
|
return true;
|
|
@@ -4896,9 +5462,10 @@ function ShadowRocket_Producer() {
|
|
|
4896
5462
|
}
|
|
4897
5463
|
if (isPresent2(proxy, "cipher") && ![
|
|
4898
5464
|
"auto",
|
|
5465
|
+
"none",
|
|
5466
|
+
"zero",
|
|
4899
5467
|
"aes-128-gcm",
|
|
4900
|
-
"chacha20-poly1305"
|
|
4901
|
-
"none"
|
|
5468
|
+
"chacha20-poly1305"
|
|
4902
5469
|
].includes(proxy.cipher)) {
|
|
4903
5470
|
proxy.cipher = "auto";
|
|
4904
5471
|
}
|
|
@@ -4940,11 +5507,25 @@ function ShadowRocket_Producer() {
|
|
|
4940
5507
|
proxy["persistent-keepalive"] = proxy.keepalive;
|
|
4941
5508
|
proxy["preshared-key"] = proxy["preshared-key"] ?? proxy["pre-shared-key"];
|
|
4942
5509
|
proxy["pre-shared-key"] = proxy["preshared-key"];
|
|
5510
|
+
} else if (proxy.type === "snell" && proxy.version < 3) {
|
|
5511
|
+
delete proxy.udp;
|
|
4943
5512
|
} else if (proxy.type === "vless") {
|
|
4944
5513
|
if (isPresent2(proxy, "sni")) {
|
|
4945
5514
|
proxy.servername = proxy.sni;
|
|
4946
5515
|
delete proxy.sni;
|
|
4947
5516
|
}
|
|
5517
|
+
} else if (proxy.type === "ss") {
|
|
5518
|
+
if (isPresent2(proxy, "shadow-tls-password") && !isPresent2(proxy, "plugin")) {
|
|
5519
|
+
proxy.plugin = "shadow-tls";
|
|
5520
|
+
proxy["plugin-opts"] = {
|
|
5521
|
+
host: proxy["shadow-tls-sni"],
|
|
5522
|
+
password: proxy["shadow-tls-password"],
|
|
5523
|
+
version: proxy["shadow-tls-version"]
|
|
5524
|
+
};
|
|
5525
|
+
delete proxy["shadow-tls-password"];
|
|
5526
|
+
delete proxy["shadow-tls-sni"];
|
|
5527
|
+
delete proxy["shadow-tls-version"];
|
|
5528
|
+
}
|
|
4948
5529
|
}
|
|
4949
5530
|
if (["vmess", "vless"].includes(proxy.type) && proxy.network === "http") {
|
|
4950
5531
|
let httpPath = proxy["http-opts"]?.path;
|
|
@@ -4976,7 +5557,8 @@ function ShadowRocket_Producer() {
|
|
|
4976
5557
|
"tuic",
|
|
4977
5558
|
"hysteria",
|
|
4978
5559
|
"hysteria2",
|
|
4979
|
-
"juicity"
|
|
5560
|
+
"juicity",
|
|
5561
|
+
"anytls"
|
|
4980
5562
|
].includes(proxy.type)) {
|
|
4981
5563
|
delete proxy.tls;
|
|
4982
5564
|
}
|
|
@@ -5192,6 +5774,10 @@ function handleTransport2(result, proxy) {
|
|
|
5192
5774
|
var detourParser = (proxy, parsedProxy) => {
|
|
5193
5775
|
parsedProxy.detour = proxy["dialer-proxy"] || proxy.detour;
|
|
5194
5776
|
};
|
|
5777
|
+
var networkParser = (proxy, parsedProxy) => {
|
|
5778
|
+
if (["tcp", "udp"].includes(proxy._network))
|
|
5779
|
+
parsedProxy.network = proxy._network;
|
|
5780
|
+
};
|
|
5195
5781
|
var tfoParser = (proxy, parsedProxy) => {
|
|
5196
5782
|
parsedProxy.tcp_fast_open = false;
|
|
5197
5783
|
if (proxy.tfo) parsedProxy.tcp_fast_open = true;
|
|
@@ -5213,6 +5799,21 @@ var smuxParser = (smux, proxy) => {
|
|
|
5213
5799
|
if (smux["min-streams"])
|
|
5214
5800
|
proxy.multiplex.min_streams = parseInt(`${smux["min-streams"]}`, 10);
|
|
5215
5801
|
if (smux.padding) proxy.multiplex.padding = true;
|
|
5802
|
+
if (smux["brutal-opts"]?.up || smux["brutal-opts"]?.down) {
|
|
5803
|
+
proxy.multiplex.brutal = {
|
|
5804
|
+
enabled: true
|
|
5805
|
+
};
|
|
5806
|
+
if (smux["brutal-opts"]?.up)
|
|
5807
|
+
proxy.multiplex.brutal.up_mbps = parseInt(
|
|
5808
|
+
`${smux["brutal-opts"]?.up}`,
|
|
5809
|
+
10
|
|
5810
|
+
);
|
|
5811
|
+
if (smux["brutal-opts"]?.down)
|
|
5812
|
+
proxy.multiplex.brutal.down_mbps = parseInt(
|
|
5813
|
+
`${smux["brutal-opts"]?.down}`,
|
|
5814
|
+
10
|
|
5815
|
+
);
|
|
5816
|
+
}
|
|
5216
5817
|
};
|
|
5217
5818
|
var wsParser = (proxy, parsedProxy) => {
|
|
5218
5819
|
const transport = { type: "ws", headers: {} };
|
|
@@ -5470,6 +6071,7 @@ var socks5Parser = (proxy = {}) => {
|
|
|
5470
6071
|
if (proxy.uot) parsedProxy.udp_over_tcp = true;
|
|
5471
6072
|
if (proxy["udp-over-tcp"]) parsedProxy.udp_over_tcp = true;
|
|
5472
6073
|
if (proxy["fast-open"]) parsedProxy.udp_fragment = true;
|
|
6074
|
+
networkParser(proxy, parsedProxy);
|
|
5473
6075
|
tfoParser(proxy, parsedProxy);
|
|
5474
6076
|
detourParser(proxy, parsedProxy);
|
|
5475
6077
|
return parsedProxy;
|
|
@@ -5518,8 +6120,14 @@ var ssParser = (proxy = {}) => {
|
|
|
5518
6120
|
if (parsedProxy.server_port < 0 || parsedProxy.server_port > 65535)
|
|
5519
6121
|
throw "invalid port";
|
|
5520
6122
|
if (proxy.uot) parsedProxy.udp_over_tcp = true;
|
|
5521
|
-
if (proxy["udp-over-tcp"])
|
|
6123
|
+
if (proxy["udp-over-tcp"]) {
|
|
6124
|
+
parsedProxy.udp_over_tcp = {
|
|
6125
|
+
enabled: true,
|
|
6126
|
+
version: !proxy["udp-over-tcp-version"] || proxy["udp-over-tcp-version"] === 1 ? 1 : 2
|
|
6127
|
+
};
|
|
6128
|
+
}
|
|
5522
6129
|
if (proxy["fast-open"]) parsedProxy.udp_fragment = true;
|
|
6130
|
+
networkParser(proxy, parsedProxy);
|
|
5523
6131
|
tfoParser(proxy, parsedProxy);
|
|
5524
6132
|
detourParser(proxy, parsedProxy);
|
|
5525
6133
|
smuxParser(proxy.smux, parsedProxy);
|
|
@@ -5629,6 +6237,7 @@ var vmessParser = (proxy = {}) => {
|
|
|
5629
6237
|
if (proxy.network === "h2") h2Parser(proxy, parsedProxy);
|
|
5630
6238
|
if (proxy.network === "http") h1Parser(proxy, parsedProxy);
|
|
5631
6239
|
if (proxy.network === "grpc") grpcParser(proxy, parsedProxy);
|
|
6240
|
+
networkParser(proxy, parsedProxy);
|
|
5632
6241
|
tfoParser(proxy, parsedProxy);
|
|
5633
6242
|
detourParser(proxy, parsedProxy);
|
|
5634
6243
|
tlsParser(proxy, parsedProxy);
|
|
@@ -5650,6 +6259,7 @@ var vlessParser = (proxy = {}) => {
|
|
|
5650
6259
|
if (proxy.flow === "xtls-rprx-vision") parsedProxy.flow = proxy.flow;
|
|
5651
6260
|
if (proxy.network === "ws") wsParser(proxy, parsedProxy);
|
|
5652
6261
|
if (proxy.network === "grpc") grpcParser(proxy, parsedProxy);
|
|
6262
|
+
networkParser(proxy, parsedProxy);
|
|
5653
6263
|
tfoParser(proxy, parsedProxy);
|
|
5654
6264
|
detourParser(proxy, parsedProxy);
|
|
5655
6265
|
smuxParser(proxy.smux, parsedProxy);
|
|
@@ -5670,6 +6280,7 @@ var trojanParser = (proxy = {}) => {
|
|
|
5670
6280
|
if (proxy["fast-open"]) parsedProxy.udp_fragment = true;
|
|
5671
6281
|
if (proxy.network === "grpc") grpcParser(proxy, parsedProxy);
|
|
5672
6282
|
if (proxy.network === "ws") wsParser(proxy, parsedProxy);
|
|
6283
|
+
networkParser(proxy, parsedProxy);
|
|
5673
6284
|
tfoParser(proxy, parsedProxy);
|
|
5674
6285
|
detourParser(proxy, parsedProxy);
|
|
5675
6286
|
tlsParser(proxy, parsedProxy);
|
|
@@ -5691,12 +6302,12 @@ var hysteriaParser = (proxy = {}) => {
|
|
|
5691
6302
|
if (proxy["auth-str"]) parsedProxy.auth_str = `${proxy["auth-str"]}`;
|
|
5692
6303
|
if (proxy["fast-open"]) parsedProxy.udp_fragment = true;
|
|
5693
6304
|
const reg = new RegExp("^[0-9]+[ ]*[KMGT]*[Bb]ps$");
|
|
5694
|
-
if (reg.test(`${proxy.up}`)) {
|
|
6305
|
+
if (reg.test(`${proxy.up}`) && !`${proxy.up}`.endsWith("Mbps")) {
|
|
5695
6306
|
parsedProxy.up = `${proxy.up}`;
|
|
5696
6307
|
} else {
|
|
5697
6308
|
parsedProxy.up_mbps = parseInt(`${proxy.up}`, 10);
|
|
5698
6309
|
}
|
|
5699
|
-
if (reg.test(`${proxy.down}`)) {
|
|
6310
|
+
if (reg.test(`${proxy.down}`) && !`${proxy.down}`.endsWith("Mbps")) {
|
|
5700
6311
|
parsedProxy.down = `${proxy.down}`;
|
|
5701
6312
|
} else {
|
|
5702
6313
|
parsedProxy.down_mbps = parseInt(`${proxy.down}`, 10);
|
|
@@ -5716,13 +6327,14 @@ var hysteriaParser = (proxy = {}) => {
|
|
|
5716
6327
|
parsedProxy.disable_mtu_discovery = true;
|
|
5717
6328
|
}
|
|
5718
6329
|
}
|
|
6330
|
+
networkParser(proxy, parsedProxy);
|
|
5719
6331
|
tlsParser(proxy, parsedProxy);
|
|
5720
6332
|
detourParser(proxy, parsedProxy);
|
|
5721
6333
|
tfoParser(proxy, parsedProxy);
|
|
5722
6334
|
smuxParser(proxy.smux, parsedProxy);
|
|
5723
6335
|
return parsedProxy;
|
|
5724
6336
|
};
|
|
5725
|
-
var hysteria2Parser = (proxy = {}
|
|
6337
|
+
var hysteria2Parser = (proxy = {}) => {
|
|
5726
6338
|
const parsedProxy = {
|
|
5727
6339
|
tag: proxy.name,
|
|
5728
6340
|
type: "hysteria2",
|
|
@@ -5734,18 +6346,17 @@ var hysteria2Parser = (proxy = {}, includeUnsupportedProxy) => {
|
|
|
5734
6346
|
};
|
|
5735
6347
|
if (parsedProxy.server_port < 0 || parsedProxy.server_port > 65535)
|
|
5736
6348
|
throw "invalid port";
|
|
5737
|
-
if (
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
parsedProxy.server_ports = proxy["ports"].split(/\s*,\s*/).map((p) => p.replace(/\s*-\s*/g, ":"));
|
|
5742
|
-
}
|
|
6349
|
+
if (proxy["hop-interval"])
|
|
6350
|
+
parsedProxy.hop_interval = /^\d+$/.test(proxy["hop-interval"]) ? `${proxy["hop-interval"]}s` : proxy["hop-interval"];
|
|
6351
|
+
if (proxy["ports"])
|
|
6352
|
+
parsedProxy.server_ports = proxy["ports"].split(/\s*,\s*/).map((p) => p.replace(/\s*-\s*/g, ":"));
|
|
5743
6353
|
if (proxy.up) parsedProxy.up_mbps = parseInt(`${proxy.up}`, 10);
|
|
5744
6354
|
if (proxy.down) parsedProxy.down_mbps = parseInt(`${proxy.down}`, 10);
|
|
5745
6355
|
if (proxy.obfs === "salamander") parsedProxy.obfs.type = "salamander";
|
|
5746
6356
|
if (proxy["obfs-password"])
|
|
5747
6357
|
parsedProxy.obfs.password = proxy["obfs-password"];
|
|
5748
6358
|
if (!parsedProxy.obfs.type) delete parsedProxy.obfs;
|
|
6359
|
+
networkParser(proxy, parsedProxy);
|
|
5749
6360
|
tlsParser(proxy, parsedProxy);
|
|
5750
6361
|
tfoParser(proxy, parsedProxy);
|
|
5751
6362
|
detourParser(proxy, parsedProxy);
|
|
@@ -5773,12 +6384,30 @@ var tuic5Parser = (proxy = {}) => {
|
|
|
5773
6384
|
if (proxy["udp-over-stream"]) parsedProxy.udp_over_stream = true;
|
|
5774
6385
|
if (proxy["heartbeat-interval"])
|
|
5775
6386
|
parsedProxy.heartbeat = `${proxy["heartbeat-interval"]}ms`;
|
|
6387
|
+
networkParser(proxy, parsedProxy);
|
|
5776
6388
|
tfoParser(proxy, parsedProxy);
|
|
5777
6389
|
detourParser(proxy, parsedProxy);
|
|
5778
6390
|
tlsParser(proxy, parsedProxy);
|
|
5779
6391
|
smuxParser(proxy.smux, parsedProxy);
|
|
5780
6392
|
return parsedProxy;
|
|
5781
6393
|
};
|
|
6394
|
+
var anytlsParser = (proxy = {}) => {
|
|
6395
|
+
const parsedProxy = {
|
|
6396
|
+
tag: proxy.name,
|
|
6397
|
+
type: "anytls",
|
|
6398
|
+
server: proxy.server,
|
|
6399
|
+
server_port: parseInt(`${proxy.port}`, 10),
|
|
6400
|
+
password: proxy.password,
|
|
6401
|
+
tls: { enabled: true, server_name: proxy.server, insecure: false }
|
|
6402
|
+
};
|
|
6403
|
+
if (/^\d+$/.test(proxy["idle-session-check-interval"]))
|
|
6404
|
+
parsedProxy.idle_session_check_interval = `${proxy["idle-session-check-interval"]}s`;
|
|
6405
|
+
if (/^\d+$/.test(proxy["idle-session-timeout"]))
|
|
6406
|
+
parsedProxy.idle_session_timeout = `${proxy["idle-session-timeout"]}s`;
|
|
6407
|
+
detourParser(proxy, parsedProxy);
|
|
6408
|
+
tlsParser(proxy, parsedProxy);
|
|
6409
|
+
return parsedProxy;
|
|
6410
|
+
};
|
|
5782
6411
|
var wireguardParser = (proxy = {}) => {
|
|
5783
6412
|
const local_address = ["ip", "ipv6"].map((i) => proxy[i]).map((i) => {
|
|
5784
6413
|
if (isIPv4(i)) return `${i}/32`;
|
|
@@ -5826,6 +6455,7 @@ var wireguardParser = (proxy = {}) => {
|
|
|
5826
6455
|
parsedProxy.peers.push(peer);
|
|
5827
6456
|
}
|
|
5828
6457
|
}
|
|
6458
|
+
networkParser(proxy, parsedProxy);
|
|
5829
6459
|
tfoParser(proxy, parsedProxy);
|
|
5830
6460
|
detourParser(proxy, parsedProxy);
|
|
5831
6461
|
smuxParser(proxy.smux, parsedProxy);
|
|
@@ -5923,6 +6553,9 @@ function singbox_Producer() {
|
|
|
5923
6553
|
case "wireguard":
|
|
5924
6554
|
list.push(wireguardParser(proxy));
|
|
5925
6555
|
break;
|
|
6556
|
+
case "anytls":
|
|
6557
|
+
list.push(anytlsParser(proxy));
|
|
6558
|
+
break;
|
|
5926
6559
|
default:
|
|
5927
6560
|
throw new Error(
|
|
5928
6561
|
`Platform sing-box does not support proxy type: ${proxy.type}`
|
|
@@ -5940,9 +6573,8 @@ function singbox_Producer() {
|
|
|
5940
6573
|
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/egern.js
|
|
5941
6574
|
function Egern_Producer() {
|
|
5942
6575
|
const type = "ALL";
|
|
5943
|
-
const produce2 = (proxies, type2
|
|
6576
|
+
const produce2 = (proxies, type2) => {
|
|
5944
6577
|
const list = proxies.filter((proxy) => {
|
|
5945
|
-
if (opts["include-unsupported-proxy"]) return true;
|
|
5946
6578
|
if (![
|
|
5947
6579
|
"http",
|
|
5948
6580
|
"socks5",
|
|
@@ -5950,7 +6582,8 @@ function Egern_Producer() {
|
|
|
5950
6582
|
"trojan",
|
|
5951
6583
|
"hysteria2",
|
|
5952
6584
|
"vless",
|
|
5953
|
-
"vmess"
|
|
6585
|
+
"vmess",
|
|
6586
|
+
"tuic"
|
|
5954
6587
|
].includes(proxy.type) || proxy.type === "ss" && (proxy.plugin === "obfs" && !["http", "tls"].includes(
|
|
5955
6588
|
proxy["plugin-opts"]?.mode
|
|
5956
6589
|
) || ![
|
|
@@ -5979,18 +6612,15 @@ function Egern_Producer() {
|
|
|
5979
6612
|
"seed-cfb",
|
|
5980
6613
|
"salsa20",
|
|
5981
6614
|
"chacha20",
|
|
5982
|
-
"chacha20-ietf"
|
|
5983
|
-
|
|
5984
|
-
"
|
|
5985
|
-
|
|
5986
|
-
"chacha20-poly1305",
|
|
5987
|
-
"none",
|
|
5988
|
-
"zero"
|
|
5989
|
-
].includes(proxy.cipher) || !["http", "ws", "tcp"].includes(proxy.network) && proxy.network) || proxy.type === "trojan" && !["http", "ws", "tcp"].includes(proxy.network) && proxy.network || proxy.type === "vless" && (typeof proxy.flow !== "undefined" || proxy["reality-opts"] || !["http", "ws", "tcp"].includes(proxy.network) && proxy.network)) {
|
|
6615
|
+
"chacha20-ietf",
|
|
6616
|
+
"2022-blake3-aes-128-gcm",
|
|
6617
|
+
"2022-blake3-aes-256-gcm"
|
|
6618
|
+
].includes(proxy.cipher)) || proxy.type === "vmess" && !["http", "ws", "tcp"].includes(proxy.network) && proxy.network || proxy.type === "trojan" && !["http", "ws", "tcp"].includes(proxy.network) && proxy.network || proxy.type === "vless" && (typeof proxy.flow !== "undefined" || proxy["reality-opts"] || !["http", "ws", "tcp"].includes(proxy.network) && proxy.network) || proxy.type === "tuic" && proxy.token && proxy.token.length !== 0) {
|
|
5990
6619
|
return false;
|
|
5991
6620
|
}
|
|
5992
6621
|
return true;
|
|
5993
6622
|
}).map((proxy) => {
|
|
6623
|
+
const original = { ...proxy };
|
|
5994
6624
|
if (proxy.tls && !proxy.sni) {
|
|
5995
6625
|
proxy.sni = proxy.server;
|
|
5996
6626
|
}
|
|
@@ -6030,10 +6660,10 @@ function Egern_Producer() {
|
|
|
6030
6660
|
udp_relay: proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
|
6031
6661
|
next_hop: proxy.next_hop
|
|
6032
6662
|
};
|
|
6033
|
-
if (
|
|
6034
|
-
proxy.obfs =
|
|
6035
|
-
proxy.obfs_host =
|
|
6036
|
-
proxy.obfs_uri =
|
|
6663
|
+
if (original.plugin === "obfs") {
|
|
6664
|
+
proxy.obfs = original["plugin-opts"].mode;
|
|
6665
|
+
proxy.obfs_host = original["plugin-opts"].host;
|
|
6666
|
+
proxy.obfs_uri = original["plugin-opts"].path;
|
|
6037
6667
|
}
|
|
6038
6668
|
} else if (proxy.type === "hysteria2") {
|
|
6039
6669
|
proxy = {
|
|
@@ -6050,10 +6680,25 @@ function Egern_Producer() {
|
|
|
6050
6680
|
port_hopping: proxy.ports,
|
|
6051
6681
|
port_hopping_interval: proxy["hop-interval"]
|
|
6052
6682
|
};
|
|
6053
|
-
if (
|
|
6683
|
+
if (original["obfs-password"] && original.obfs == "salamander") {
|
|
6054
6684
|
proxy.obfs = "salamander";
|
|
6055
|
-
proxy.obfs_password =
|
|
6685
|
+
proxy.obfs_password = original["obfs-password"];
|
|
6056
6686
|
}
|
|
6687
|
+
} else if (proxy.type === "tuic") {
|
|
6688
|
+
proxy = {
|
|
6689
|
+
type: "tuic",
|
|
6690
|
+
name: proxy.name,
|
|
6691
|
+
server: proxy.server,
|
|
6692
|
+
port: proxy.port,
|
|
6693
|
+
uuid: proxy.uuid,
|
|
6694
|
+
password: proxy.password,
|
|
6695
|
+
next_hop: proxy.next_hop,
|
|
6696
|
+
sni: proxy.sni,
|
|
6697
|
+
alpn: Array.isArray(proxy.alpn) ? proxy.alpn : [proxy.alpn || "h3"],
|
|
6698
|
+
skip_tls_verify: proxy["skip-cert-verify"],
|
|
6699
|
+
port_hopping: proxy.ports,
|
|
6700
|
+
port_hopping_interval: proxy["hop-interval"]
|
|
6701
|
+
};
|
|
6057
6702
|
} else if (proxy.type === "trojan") {
|
|
6058
6703
|
if (proxy.network === "ws") {
|
|
6059
6704
|
proxy.websocket = {
|
|
@@ -6075,6 +6720,16 @@ function Egern_Producer() {
|
|
|
6075
6720
|
websocket: proxy.websocket
|
|
6076
6721
|
};
|
|
6077
6722
|
} else if (proxy.type === "vmess") {
|
|
6723
|
+
let security = proxy.cipher;
|
|
6724
|
+
if (security && ![
|
|
6725
|
+
"auto",
|
|
6726
|
+
"none",
|
|
6727
|
+
"zero",
|
|
6728
|
+
"aes-128-gcm",
|
|
6729
|
+
"chacha20-poly1305"
|
|
6730
|
+
].includes(security)) {
|
|
6731
|
+
security = "auto";
|
|
6732
|
+
}
|
|
6078
6733
|
if (proxy.network === "ws") {
|
|
6079
6734
|
proxy.transport = {
|
|
6080
6735
|
[proxy.tls ? "wss" : "ws"]: {
|
|
@@ -6088,9 +6743,9 @@ function Egern_Producer() {
|
|
|
6088
6743
|
};
|
|
6089
6744
|
} else if (proxy.network === "http") {
|
|
6090
6745
|
proxy.transport = {
|
|
6091
|
-
|
|
6746
|
+
http1: {
|
|
6092
6747
|
method: proxy["http-opts"]?.method,
|
|
6093
|
-
path: proxy["http-opts"]?.path,
|
|
6748
|
+
path: Array.isArray(proxy["http-opts"]?.path) ? proxy["http-opts"]?.path[0] : proxy["http-opts"]?.path,
|
|
6094
6749
|
headers: {
|
|
6095
6750
|
Host: Array.isArray(
|
|
6096
6751
|
proxy["http-opts"]?.headers?.Host
|
|
@@ -6099,9 +6754,22 @@ function Egern_Producer() {
|
|
|
6099
6754
|
skip_tls_verify: proxy["skip-cert-verify"]
|
|
6100
6755
|
}
|
|
6101
6756
|
};
|
|
6102
|
-
} else if (proxy.network === "
|
|
6757
|
+
} else if (proxy.network === "h2") {
|
|
6103
6758
|
proxy.transport = {
|
|
6104
|
-
|
|
6759
|
+
http2: {
|
|
6760
|
+
method: proxy["h2-opts"]?.method,
|
|
6761
|
+
path: Array.isArray(proxy["h2-opts"]?.path) ? proxy["h2-opts"]?.path[0] : proxy["h2-opts"]?.path,
|
|
6762
|
+
headers: {
|
|
6763
|
+
Host: Array.isArray(
|
|
6764
|
+
proxy["h2-opts"]?.headers?.Host
|
|
6765
|
+
) ? proxy["h2-opts"]?.headers?.Host[0] : proxy["h2-opts"]?.headers?.Host
|
|
6766
|
+
},
|
|
6767
|
+
skip_tls_verify: proxy["skip-cert-verify"]
|
|
6768
|
+
}
|
|
6769
|
+
};
|
|
6770
|
+
} else if ((proxy.network === "tcp" || !proxy.network) && proxy.tls) {
|
|
6771
|
+
proxy.transport = {
|
|
6772
|
+
tls: {
|
|
6105
6773
|
sni: proxy.tls ? proxy.sni : void 0,
|
|
6106
6774
|
skip_tls_verify: proxy.tls ? proxy["skip-cert-verify"] : void 0
|
|
6107
6775
|
}
|
|
@@ -6113,7 +6781,7 @@ function Egern_Producer() {
|
|
|
6113
6781
|
server: proxy.server,
|
|
6114
6782
|
port: proxy.port,
|
|
6115
6783
|
user_id: proxy.uuid,
|
|
6116
|
-
security
|
|
6784
|
+
security,
|
|
6117
6785
|
tfo: proxy.tfo || proxy["fast-open"],
|
|
6118
6786
|
legacy: proxy.legacy,
|
|
6119
6787
|
udp_relay: proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
|
@@ -6138,7 +6806,7 @@ function Egern_Producer() {
|
|
|
6138
6806
|
proxy.transport = {
|
|
6139
6807
|
http: {
|
|
6140
6808
|
method: proxy["http-opts"]?.method,
|
|
6141
|
-
path: proxy["http-opts"]?.path,
|
|
6809
|
+
path: Array.isArray(proxy["http-opts"]?.path) ? proxy["http-opts"]?.path[0] : proxy["http-opts"]?.path,
|
|
6142
6810
|
headers: {
|
|
6143
6811
|
Host: Array.isArray(
|
|
6144
6812
|
proxy["http-opts"]?.headers?.Host
|
|
@@ -6171,6 +6839,34 @@ function Egern_Producer() {
|
|
|
6171
6839
|
// skip_tls_verify: proxy['skip-cert-verify'],
|
|
6172
6840
|
};
|
|
6173
6841
|
}
|
|
6842
|
+
if ([
|
|
6843
|
+
"http",
|
|
6844
|
+
"socks5",
|
|
6845
|
+
"ss",
|
|
6846
|
+
"trojan",
|
|
6847
|
+
"vless",
|
|
6848
|
+
"vmess"
|
|
6849
|
+
].includes(original.type)) {
|
|
6850
|
+
if (isPresent2(original, "shadow-tls-password")) {
|
|
6851
|
+
if (original["shadow-tls-version"] != 3)
|
|
6852
|
+
throw new Error(
|
|
6853
|
+
`shadow-tls version ${original["shadow-tls-version"]} is not supported`
|
|
6854
|
+
);
|
|
6855
|
+
proxy.shadow_tls = {
|
|
6856
|
+
password: original["shadow-tls-password"],
|
|
6857
|
+
sni: original["shadow-tls-sni"]
|
|
6858
|
+
};
|
|
6859
|
+
} else if (["shadow-tls"].includes(original.plugin) && original["plugin-opts"]) {
|
|
6860
|
+
if (original["plugin-opts"].version != 3)
|
|
6861
|
+
throw new Error(
|
|
6862
|
+
`shadow-tls version ${original["plugin-opts"].version} is not supported`
|
|
6863
|
+
);
|
|
6864
|
+
proxy.shadow_tls = {
|
|
6865
|
+
password: original["plugin-opts"].password,
|
|
6866
|
+
sni: original["plugin-opts"].host
|
|
6867
|
+
};
|
|
6868
|
+
}
|
|
6869
|
+
}
|
|
6174
6870
|
delete proxy.subName;
|
|
6175
6871
|
delete proxy.collectionName;
|
|
6176
6872
|
delete proxy.id;
|
|
@@ -6203,21 +6899,38 @@ function JSON_Producer() {
|
|
|
6203
6899
|
return { type, produce: produce2 };
|
|
6204
6900
|
}
|
|
6205
6901
|
var producers_default = {
|
|
6902
|
+
qx: QX_Producer(),
|
|
6206
6903
|
QX: QX_Producer(),
|
|
6207
6904
|
QuantumultX: QX_Producer(),
|
|
6905
|
+
surge: Surge_Producer(),
|
|
6208
6906
|
Surge: Surge_Producer(),
|
|
6209
6907
|
SurgeMac: SurgeMac_Producer(),
|
|
6210
6908
|
Loon: Loon_Producer(),
|
|
6211
6909
|
Clash: Clash_Producer(),
|
|
6910
|
+
meta: ClashMeta_Producer(),
|
|
6911
|
+
clashmeta: ClashMeta_Producer(),
|
|
6912
|
+
"clash.meta": ClashMeta_Producer(),
|
|
6913
|
+
"Clash.Meta": ClashMeta_Producer(),
|
|
6212
6914
|
ClashMeta: ClashMeta_Producer(),
|
|
6915
|
+
mihomo: ClashMeta_Producer(),
|
|
6916
|
+
Mihomo: ClashMeta_Producer(),
|
|
6917
|
+
uri: URI_Producer(),
|
|
6213
6918
|
URI: URI_Producer(),
|
|
6919
|
+
v2: V2Ray_Producer(),
|
|
6920
|
+
v2ray: V2Ray_Producer(),
|
|
6214
6921
|
V2Ray: V2Ray_Producer(),
|
|
6922
|
+
json: JSON_Producer(),
|
|
6215
6923
|
JSON: JSON_Producer(),
|
|
6924
|
+
stash: Stash_Producer(),
|
|
6216
6925
|
Stash: Stash_Producer(),
|
|
6217
|
-
|
|
6218
|
-
|
|
6926
|
+
shadowrocket: Shadowrocket_Producer(),
|
|
6927
|
+
Shadowrocket: Shadowrocket_Producer(),
|
|
6928
|
+
ShadowRocket: Shadowrocket_Producer(),
|
|
6929
|
+
surfboard: Surfboard_Producer(),
|
|
6219
6930
|
Surfboard: Surfboard_Producer(),
|
|
6931
|
+
singbox: singbox_Producer(),
|
|
6220
6932
|
"sing-box": singbox_Producer(),
|
|
6933
|
+
egern: Egern_Producer(),
|
|
6221
6934
|
Egern: Egern_Producer()
|
|
6222
6935
|
};
|
|
6223
6936
|
|