sub-store-convert 2.14.421 → 2.15.11
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/README.md +4 -0
- package/build/index.js +458 -53
- package/package.json +1 -1
package/README.md
CHANGED
package/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Sub-Store/backend/src/utils/index.js
|
|
1
|
+
// src/vendors/Sub-Store/backend/src/utils/index.js
|
|
2
2
|
import * as ipAddress from "ip-address";
|
|
3
3
|
var IPV4_REGEX = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/;
|
|
4
4
|
var IPV6_REGEX = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
@@ -36,7 +36,7 @@ function getRandomPort(portString) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// Sub-Store/backend/src/core/proxy-utils/parsers/peggy/surge.js
|
|
39
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/parsers/peggy/surge.js
|
|
40
40
|
import * as peggy from "peggy";
|
|
41
41
|
var grammars = String.raw`
|
|
42
42
|
// global initializer
|
|
@@ -76,7 +76,7 @@ var grammars = String.raw`
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
start = (shadowsocks/vmess/trojan/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh) {
|
|
79
|
+
start = (shadowsocks/vmess/trojan/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/direct) {
|
|
80
80
|
return proxy;
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -147,15 +147,18 @@ hysteria2 = tag equals "hysteria2" address (no_error_alert/ip_version/underlying
|
|
|
147
147
|
proxy.type = "hysteria2";
|
|
148
148
|
handleShadowTLS();
|
|
149
149
|
}
|
|
150
|
-
socks5 = tag equals "socks5" address (username password)? (usernamek passwordk)? (no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/fast_open/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
|
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/fast_open/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)? (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/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)* {
|
|
160
|
+
proxy.type = "direct";
|
|
161
|
+
}
|
|
159
162
|
|
|
160
163
|
address = comma server:server comma port:port {
|
|
161
164
|
proxy.server = server;
|
|
@@ -232,7 +235,7 @@ snell_psk = comma "psk" equals match:[^,]+ { proxy.psk = match.join(""); }
|
|
|
232
235
|
snell_version = comma "version" equals match:$[0-9]+ { proxy.version = parseInt(match.trim()); }
|
|
233
236
|
|
|
234
237
|
usernamek = comma "username" equals match:[^,]+ { proxy.username = match.join(""); }
|
|
235
|
-
passwordk = comma "password" equals match:[^,]+ { proxy.password = match.join(""); }
|
|
238
|
+
passwordk = comma "password" equals match:[^,]+ { proxy.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
|
236
239
|
vmess_uuid = comma "username" equals match:[^,]+ { proxy.uuid = match.join(""); }
|
|
237
240
|
vmess_aead = comma "vmess-aead" equals flag:bool { proxy.aead = flag; }
|
|
238
241
|
|
|
@@ -302,7 +305,7 @@ function getParser() {
|
|
|
302
305
|
return parser;
|
|
303
306
|
}
|
|
304
307
|
|
|
305
|
-
// Sub-Store/backend/src/core/proxy-utils/parsers/peggy/loon.js
|
|
308
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/parsers/peggy/loon.js
|
|
306
309
|
import * as peggy2 from "peggy";
|
|
307
310
|
var grammars2 = String.raw`
|
|
308
311
|
// global initializer
|
|
@@ -425,7 +428,7 @@ port = digits:[0-9]+ {
|
|
|
425
428
|
method = comma cipher:cipher {
|
|
426
429
|
proxy.cipher = cipher;
|
|
427
430
|
}
|
|
428
|
-
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"/"auto"/"bf-cfb"/"camellia-128-cfb"/"camellia-192-cfb"/"camellia-256-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"none"/"rc4-md5"/"rc4"/"salsa20"/"xchacha20-ietf-poly1305");
|
|
431
|
+
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"/"auto"/"bf-cfb"/"camellia-128-cfb"/"camellia-192-cfb"/"camellia-256-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"none"/"rc4-md5"/"rc4"/"salsa20"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm");
|
|
429
432
|
|
|
430
433
|
username = & {
|
|
431
434
|
let j = peg$currPos;
|
|
@@ -502,7 +505,7 @@ function getParser2() {
|
|
|
502
505
|
return parser2;
|
|
503
506
|
}
|
|
504
507
|
|
|
505
|
-
// Sub-Store/backend/src/core/proxy-utils/parsers/peggy/qx.js
|
|
508
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/parsers/peggy/qx.js
|
|
506
509
|
import * as peggy3 from "peggy";
|
|
507
510
|
var grammars3 = String.raw`
|
|
508
511
|
// global initializer
|
|
@@ -708,7 +711,7 @@ function getParser3() {
|
|
|
708
711
|
return parser3;
|
|
709
712
|
}
|
|
710
713
|
|
|
711
|
-
// Sub-Store/backend/src/core/proxy-utils/parsers/peggy/trojan-uri.js
|
|
714
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/parsers/peggy/trojan-uri.js
|
|
712
715
|
import * as peggy4 from "peggy";
|
|
713
716
|
var grammars4 = String.raw`
|
|
714
717
|
// global initializer
|
|
@@ -793,6 +796,8 @@ port = digits:[0-9]+ {
|
|
|
793
796
|
params = "?" head:param tail:("&"@param)* {
|
|
794
797
|
proxy["skip-cert-verify"] = toBool(params["allowInsecure"]);
|
|
795
798
|
proxy.sni = params["sni"] || params["peer"];
|
|
799
|
+
proxy['client-fingerprint'] = params.fp;
|
|
800
|
+
proxy.alpn = params.alpn ? decodeURIComponent(params.alpn).split(',') : undefined;
|
|
796
801
|
|
|
797
802
|
if (toBool(params["ws"])) {
|
|
798
803
|
proxy.network = "ws";
|
|
@@ -810,6 +815,7 @@ params = "?" head:param tail:("&"@param)* {
|
|
|
810
815
|
proxy[proxy.network + '-opts'] = {
|
|
811
816
|
'grpc-service-name': params["serviceName"],
|
|
812
817
|
'_grpc-type': params["mode"],
|
|
818
|
+
'_grpc-authority': params["authority"],
|
|
813
819
|
};
|
|
814
820
|
} else {
|
|
815
821
|
if (params["path"]) {
|
|
@@ -851,7 +857,7 @@ function getParser4() {
|
|
|
851
857
|
return parser4;
|
|
852
858
|
}
|
|
853
859
|
|
|
854
|
-
// Sub-Store/backend/src/core/proxy-utils/parsers/index.js
|
|
860
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/parsers/index.js
|
|
855
861
|
import { Base64 } from "js-base64";
|
|
856
862
|
function surge_port_hopping(raw) {
|
|
857
863
|
const [parts, port_hopping] = raw.match(
|
|
@@ -862,6 +868,28 @@ function surge_port_hopping(raw) {
|
|
|
862
868
|
line: parts ? raw.replace(parts, "") : raw
|
|
863
869
|
};
|
|
864
870
|
}
|
|
871
|
+
function URI_PROXY() {
|
|
872
|
+
const name = "URI PROXY Parser";
|
|
873
|
+
const test = (line) => {
|
|
874
|
+
return /^(socks5\+tls|socks5|http|https):\/\//.test(line);
|
|
875
|
+
};
|
|
876
|
+
const parse = (line) => {
|
|
877
|
+
let [__, type, tls, username, password, server, port, query, name2] = line.match(
|
|
878
|
+
/^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?):(\d+?)(\?.*?)?(?:#(.*?))?$/
|
|
879
|
+
);
|
|
880
|
+
const proxy = {
|
|
881
|
+
name: name2 != null ? decodeURIComponent(name2) : `${type} ${server}:${port}`,
|
|
882
|
+
type,
|
|
883
|
+
tls: tls ? true : false,
|
|
884
|
+
server,
|
|
885
|
+
port,
|
|
886
|
+
username: username != null ? decodeURIComponent(username) : void 0,
|
|
887
|
+
password: password != null ? decodeURIComponent(password) : void 0
|
|
888
|
+
};
|
|
889
|
+
return proxy;
|
|
890
|
+
};
|
|
891
|
+
return { name, test, parse };
|
|
892
|
+
}
|
|
865
893
|
function URI_SS() {
|
|
866
894
|
const name = "URI SS Parser";
|
|
867
895
|
const test = (line) => {
|
|
@@ -875,7 +903,13 @@ function URI_SS() {
|
|
|
875
903
|
};
|
|
876
904
|
content = content.split("#")[0];
|
|
877
905
|
let serverAndPortArray = content.match(/@([^/]*)(\/|$)/);
|
|
878
|
-
let
|
|
906
|
+
let rawUserInfoStr = decodeURIComponent(content.split("@")[0]);
|
|
907
|
+
let userInfoStr;
|
|
908
|
+
if (rawUserInfoStr?.startsWith("2022-blake3-")) {
|
|
909
|
+
userInfoStr = rawUserInfoStr;
|
|
910
|
+
} else {
|
|
911
|
+
userInfoStr = Base64.decode(rawUserInfoStr);
|
|
912
|
+
}
|
|
879
913
|
let query = "";
|
|
880
914
|
if (!serverAndPortArray) {
|
|
881
915
|
if (content.includes("?")) {
|
|
@@ -906,9 +940,9 @@ function URI_SS() {
|
|
|
906
940
|
proxy.port = `${serverAndPort.substring(portIdx + 1)}`.match(
|
|
907
941
|
/\d+/
|
|
908
942
|
)?.[0];
|
|
909
|
-
|
|
910
|
-
proxy.cipher = userInfo[1];
|
|
911
|
-
proxy.password = userInfo[2];
|
|
943
|
+
let userInfo = userInfoStr.match(/(^.*?):(.*$)/);
|
|
944
|
+
proxy.cipher = userInfo?.[1];
|
|
945
|
+
proxy.password = userInfo?.[2];
|
|
912
946
|
const idx = content.indexOf("?plugin=");
|
|
913
947
|
if (idx !== -1) {
|
|
914
948
|
const pluginInfo = ("plugin=" + decodeURIComponent(content.split("?plugin=")[1].split("&")[0])).split(";");
|
|
@@ -1140,7 +1174,8 @@ function URI_VMess() {
|
|
|
1140
1174
|
if (["grpc"].includes(proxy.network)) {
|
|
1141
1175
|
proxy[`${proxy.network}-opts`] = {
|
|
1142
1176
|
"grpc-service-name": getIfNotBlank(transportPath),
|
|
1143
|
-
"_grpc-type": getIfNotBlank(params.type)
|
|
1177
|
+
"_grpc-type": getIfNotBlank(params.type),
|
|
1178
|
+
"_grpc-authority": getIfNotBlank(params.authority)
|
|
1144
1179
|
};
|
|
1145
1180
|
} else {
|
|
1146
1181
|
const opts = {
|
|
@@ -1260,6 +1295,9 @@ function URI_VLESS() {
|
|
|
1260
1295
|
}
|
|
1261
1296
|
if (params.serviceName) {
|
|
1262
1297
|
opts[`${proxy.network}-service-name`] = params.serviceName;
|
|
1298
|
+
if (["grpc"].includes(proxy.network) && params.authority) {
|
|
1299
|
+
opts["_grpc-authority"] = params.authority;
|
|
1300
|
+
}
|
|
1263
1301
|
} else if (isShadowrocket && params.path) {
|
|
1264
1302
|
if (!["ws", "http", "h2"].includes(proxy.network)) {
|
|
1265
1303
|
opts[`${proxy.network}-service-name`] = params.path;
|
|
@@ -1544,6 +1582,11 @@ function URI_Trojan() {
|
|
|
1544
1582
|
return /^trojan:\/\//.test(line);
|
|
1545
1583
|
};
|
|
1546
1584
|
const parse = (line) => {
|
|
1585
|
+
const matched = /^(trojan:\/\/.*?@.*?)(:(\d+))?\/?(\?.*?)?$/.exec(line);
|
|
1586
|
+
const port = matched?.[2];
|
|
1587
|
+
if (!port) {
|
|
1588
|
+
line = line.replace(matched[1], `${matched[1]}:443`);
|
|
1589
|
+
}
|
|
1547
1590
|
let [newLine, name2] = line.split(/#(.+)/, 2);
|
|
1548
1591
|
const parser5 = getParser4();
|
|
1549
1592
|
const proxy = parser5.parse(newLine);
|
|
@@ -1571,6 +1614,8 @@ function Clash_All() {
|
|
|
1571
1614
|
const parse = (line) => {
|
|
1572
1615
|
const proxy = JSON.parse(line);
|
|
1573
1616
|
if (![
|
|
1617
|
+
"mieru",
|
|
1618
|
+
"juicity",
|
|
1574
1619
|
"ss",
|
|
1575
1620
|
"ssr",
|
|
1576
1621
|
"vmess",
|
|
@@ -1583,7 +1628,8 @@ function Clash_All() {
|
|
|
1583
1628
|
"hysteria",
|
|
1584
1629
|
"hysteria2",
|
|
1585
1630
|
"wireguard",
|
|
1586
|
-
"ssh"
|
|
1631
|
+
"ssh",
|
|
1632
|
+
"direct"
|
|
1587
1633
|
].includes(proxy.type)) {
|
|
1588
1634
|
throw new Error(
|
|
1589
1635
|
`Clash does not support proxy with type: ${proxy.type}`
|
|
@@ -1835,6 +1881,14 @@ function Loon_WireGuard() {
|
|
|
1835
1881
|
};
|
|
1836
1882
|
return { name, test, parse };
|
|
1837
1883
|
}
|
|
1884
|
+
function Surge_Direct() {
|
|
1885
|
+
const name = "Surge Direct Parser";
|
|
1886
|
+
const test = (line) => {
|
|
1887
|
+
return /^.*=\s*direct/.test(line.split(",")[0]);
|
|
1888
|
+
};
|
|
1889
|
+
const parse = (line) => getParser().parse(line);
|
|
1890
|
+
return { name, test, parse };
|
|
1891
|
+
}
|
|
1838
1892
|
function Surge_SSH() {
|
|
1839
1893
|
const name = "Surge SSH Parser";
|
|
1840
1894
|
const test = (line) => {
|
|
@@ -1989,6 +2043,7 @@ function isIP(ip) {
|
|
|
1989
2043
|
return isIPv4(ip) || isIPv6(ip);
|
|
1990
2044
|
}
|
|
1991
2045
|
var parsers_default = [
|
|
2046
|
+
URI_PROXY(),
|
|
1992
2047
|
URI_SS(),
|
|
1993
2048
|
URI_SSR(),
|
|
1994
2049
|
URI_VMess(),
|
|
@@ -1999,6 +2054,7 @@ var parsers_default = [
|
|
|
1999
2054
|
URI_Hysteria2(),
|
|
2000
2055
|
URI_Trojan(),
|
|
2001
2056
|
Clash_All(),
|
|
2057
|
+
Surge_Direct(),
|
|
2002
2058
|
Surge_SSH(),
|
|
2003
2059
|
Surge_SS(),
|
|
2004
2060
|
Surge_VMess(),
|
|
@@ -2028,7 +2084,7 @@ var parsers_default = [
|
|
|
2028
2084
|
QX_Socks5()
|
|
2029
2085
|
];
|
|
2030
2086
|
|
|
2031
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/utils.js
|
|
2087
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/utils.js
|
|
2032
2088
|
import _ from "lodash";
|
|
2033
2089
|
var Result = class {
|
|
2034
2090
|
constructor(proxy) {
|
|
@@ -2067,7 +2123,7 @@ var app_default = new Proxy(console, {
|
|
|
2067
2123
|
}
|
|
2068
2124
|
});
|
|
2069
2125
|
|
|
2070
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/surge.js
|
|
2126
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/surge.js
|
|
2071
2127
|
var targetPlatform = "Surge";
|
|
2072
2128
|
var ipVersions = {
|
|
2073
2129
|
dual: "dual",
|
|
@@ -2091,6 +2147,8 @@ function Surge_Producer() {
|
|
|
2091
2147
|
return vmess(proxy, opts["include-unsupported-proxy"]);
|
|
2092
2148
|
case "http":
|
|
2093
2149
|
return http(proxy);
|
|
2150
|
+
case "direct":
|
|
2151
|
+
return direct(proxy);
|
|
2094
2152
|
case "socks5":
|
|
2095
2153
|
return socks5(proxy);
|
|
2096
2154
|
case "snell":
|
|
@@ -2151,7 +2209,7 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
|
|
|
2151
2209
|
throw new Error(`cipher ${proxy.cipher} is not supported`);
|
|
2152
2210
|
}
|
|
2153
2211
|
result.append(`,encrypt-method=${proxy.cipher}`);
|
|
2154
|
-
result.appendIfPresent(`,password
|
|
2212
|
+
result.appendIfPresent(`,password="${proxy.password}"`, "password");
|
|
2155
2213
|
const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
|
|
2156
2214
|
result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
|
|
2157
2215
|
result.appendIfPresent(
|
|
@@ -2231,7 +2289,7 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
|
|
|
2231
2289
|
function trojan(proxy) {
|
|
2232
2290
|
const result = new Result(proxy);
|
|
2233
2291
|
result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
|
|
2234
|
-
result.appendIfPresent(`,password
|
|
2292
|
+
result.appendIfPresent(`,password="${proxy.password}"`, "password");
|
|
2235
2293
|
const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
|
|
2236
2294
|
result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
|
|
2237
2295
|
result.appendIfPresent(
|
|
@@ -2351,7 +2409,7 @@ function ssh(proxy) {
|
|
|
2351
2409
|
const result = new Result(proxy);
|
|
2352
2410
|
result.append(`${proxy.name}=ssh,${proxy.server},${proxy.port}`);
|
|
2353
2411
|
result.appendIfPresent(`,${proxy.username}`, "username");
|
|
2354
|
-
result.appendIfPresent(
|
|
2412
|
+
result.appendIfPresent(`,"${proxy.password}"`, "password");
|
|
2355
2413
|
result.appendIfPresent(
|
|
2356
2414
|
`,private-key=${proxy["keystore-private-key"]}`,
|
|
2357
2415
|
"keystore-private-key"
|
|
@@ -2400,7 +2458,7 @@ function http(proxy) {
|
|
|
2400
2458
|
const type = proxy.tls ? "https" : "http";
|
|
2401
2459
|
result.append(`${proxy.name}=${type},${proxy.server},${proxy.port}`);
|
|
2402
2460
|
result.appendIfPresent(`,${proxy.username}`, "username");
|
|
2403
|
-
result.appendIfPresent(
|
|
2461
|
+
result.appendIfPresent(`,"${proxy.password}"`, "password");
|
|
2404
2462
|
const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
|
|
2405
2463
|
result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
|
|
2406
2464
|
result.appendIfPresent(
|
|
@@ -2452,12 +2510,47 @@ function http(proxy) {
|
|
|
2452
2510
|
);
|
|
2453
2511
|
return result.toString();
|
|
2454
2512
|
}
|
|
2513
|
+
function direct(proxy) {
|
|
2514
|
+
const result = new Result(proxy);
|
|
2515
|
+
const type = "direct";
|
|
2516
|
+
result.append(`${proxy.name}=${type}`);
|
|
2517
|
+
const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
|
|
2518
|
+
result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
|
|
2519
|
+
result.appendIfPresent(
|
|
2520
|
+
`,no-error-alert=${proxy["no-error-alert"]}`,
|
|
2521
|
+
"no-error-alert"
|
|
2522
|
+
);
|
|
2523
|
+
result.appendIfPresent(`,tfo=${proxy.tfo}`, "tfo");
|
|
2524
|
+
result.appendIfPresent(`,udp-relay=${proxy.udp}`, "udp");
|
|
2525
|
+
result.appendIfPresent(`,test-url=${proxy["test-url"]}`, "test-url");
|
|
2526
|
+
result.appendIfPresent(
|
|
2527
|
+
`,test-timeout=${proxy["test-timeout"]}`,
|
|
2528
|
+
"test-timeout"
|
|
2529
|
+
);
|
|
2530
|
+
result.appendIfPresent(`,test-udp=${proxy["test-udp"]}`, "test-udp");
|
|
2531
|
+
result.appendIfPresent(`,hybrid=${proxy["hybrid"]}`, "hybrid");
|
|
2532
|
+
result.appendIfPresent(`,tos=${proxy["tos"]}`, "tos");
|
|
2533
|
+
result.appendIfPresent(
|
|
2534
|
+
`,allow-other-interface=${proxy["allow-other-interface"]}`,
|
|
2535
|
+
"allow-other-interface"
|
|
2536
|
+
);
|
|
2537
|
+
result.appendIfPresent(
|
|
2538
|
+
`,interface=${proxy["interface-name"]}`,
|
|
2539
|
+
"interface-name"
|
|
2540
|
+
);
|
|
2541
|
+
result.appendIfPresent(`,block-quic=${proxy["block-quic"]}`, "block-quic");
|
|
2542
|
+
result.appendIfPresent(
|
|
2543
|
+
`,underlying-proxy=${proxy["underlying-proxy"]}`,
|
|
2544
|
+
"underlying-proxy"
|
|
2545
|
+
);
|
|
2546
|
+
return result.toString();
|
|
2547
|
+
}
|
|
2455
2548
|
function socks5(proxy) {
|
|
2456
2549
|
const result = new Result(proxy);
|
|
2457
2550
|
const type = proxy.tls ? "socks5-tls" : "socks5";
|
|
2458
2551
|
result.append(`${proxy.name}=${type},${proxy.server},${proxy.port}`);
|
|
2459
2552
|
result.appendIfPresent(`,${proxy.username}`, "username");
|
|
2460
|
-
result.appendIfPresent(
|
|
2553
|
+
result.appendIfPresent(`,"${proxy.password}"`, "password");
|
|
2461
2554
|
const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
|
|
2462
2555
|
result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
|
|
2463
2556
|
result.appendIfPresent(
|
|
@@ -2579,7 +2672,7 @@ function tuic(proxy) {
|
|
|
2579
2672
|
}
|
|
2580
2673
|
result.append(`${proxy.name}=${type},${proxy.server},${proxy.port}`);
|
|
2581
2674
|
result.appendIfPresent(`,uuid=${proxy.uuid}`, "uuid");
|
|
2582
|
-
result.appendIfPresent(`,password
|
|
2675
|
+
result.appendIfPresent(`,password="${proxy.password}"`, "password");
|
|
2583
2676
|
result.appendIfPresent(`,token=${proxy.token}`, "token");
|
|
2584
2677
|
result.appendIfPresent(
|
|
2585
2678
|
`,alpn=${Array.isArray(proxy.alpn) ? proxy.alpn[0] : proxy.alpn}`,
|
|
@@ -2798,7 +2891,7 @@ function hysteria2(proxy) {
|
|
|
2798
2891
|
}
|
|
2799
2892
|
const result = new Result(proxy);
|
|
2800
2893
|
result.append(`${proxy.name}=hysteria2,${proxy.server},${proxy.port}`);
|
|
2801
|
-
result.appendIfPresent(`,password
|
|
2894
|
+
result.appendIfPresent(`,password="${proxy.password}"`, "password");
|
|
2802
2895
|
if (isPresent2(proxy, "ports")) {
|
|
2803
2896
|
result.append(`,port-hopping="${proxy.ports.replace(/,/g, ";")}"`);
|
|
2804
2897
|
}
|
|
@@ -2900,10 +2993,10 @@ function handleTransport(result, proxy, includeUnsupportedProxy) {
|
|
|
2900
2993
|
}
|
|
2901
2994
|
}
|
|
2902
2995
|
|
|
2903
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/surgemac.js
|
|
2996
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/surgemac.js
|
|
2904
2997
|
import { Base64 as Base642 } from "js-base64";
|
|
2905
2998
|
|
|
2906
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/clashmeta.js
|
|
2999
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/clashmeta.js
|
|
2907
3000
|
function ClashMeta_Producer() {
|
|
2908
3001
|
const type = "ALL";
|
|
2909
3002
|
const produce2 = (proxies, type2, opts = {}) => {
|
|
@@ -2911,6 +3004,8 @@ function ClashMeta_Producer() {
|
|
|
2911
3004
|
if (opts["include-unsupported-proxy"]) return true;
|
|
2912
3005
|
if (proxy.type === "snell" && String(proxy.version) === "4") {
|
|
2913
3006
|
return false;
|
|
3007
|
+
} else if (["juicity"].includes(proxy.type)) {
|
|
3008
|
+
return false;
|
|
2914
3009
|
}
|
|
2915
3010
|
return true;
|
|
2916
3011
|
}).map((proxy) => {
|
|
@@ -3034,6 +3129,7 @@ function ClashMeta_Producer() {
|
|
|
3034
3129
|
}
|
|
3035
3130
|
if (["grpc"].includes(proxy.network) && proxy[`${proxy.network}-opts`]) {
|
|
3036
3131
|
delete proxy[`${proxy.network}-opts`]["_grpc-type"];
|
|
3132
|
+
delete proxy[`${proxy.network}-opts`]["_grpc-authority"];
|
|
3037
3133
|
}
|
|
3038
3134
|
return proxy;
|
|
3039
3135
|
});
|
|
@@ -3042,7 +3138,7 @@ function ClashMeta_Producer() {
|
|
|
3042
3138
|
return { type, produce: produce2 };
|
|
3043
3139
|
}
|
|
3044
3140
|
|
|
3045
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/surgemac.js
|
|
3141
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/surgemac.js
|
|
3046
3142
|
var targetPlatform2 = "SurgeMac";
|
|
3047
3143
|
var surge_Producer = Surge_Producer();
|
|
3048
3144
|
function SurgeMac_Producer() {
|
|
@@ -3161,7 +3257,7 @@ function isIP2(ip) {
|
|
|
3161
3257
|
return isIPv4(ip) || isIPv6(ip);
|
|
3162
3258
|
}
|
|
3163
3259
|
|
|
3164
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/clash.js
|
|
3260
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/clash.js
|
|
3165
3261
|
function Clash_Producer() {
|
|
3166
3262
|
const type = "ALL";
|
|
3167
3263
|
const produce2 = (proxies, type2, opts = {}) => {
|
|
@@ -3286,6 +3382,7 @@ function Clash_Producer() {
|
|
|
3286
3382
|
}
|
|
3287
3383
|
if (["grpc"].includes(proxy.network) && proxy[`${proxy.network}-opts`]) {
|
|
3288
3384
|
delete proxy[`${proxy.network}-opts`]["_grpc-type"];
|
|
3385
|
+
delete proxy[`${proxy.network}-opts`]["_grpc-authority"];
|
|
3289
3386
|
}
|
|
3290
3387
|
return proxy;
|
|
3291
3388
|
});
|
|
@@ -3294,12 +3391,11 @@ function Clash_Producer() {
|
|
|
3294
3391
|
return { type, produce: produce2 };
|
|
3295
3392
|
}
|
|
3296
3393
|
|
|
3297
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/stash.js
|
|
3394
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/stash.js
|
|
3298
3395
|
function Stash_Producer() {
|
|
3299
3396
|
const type = "ALL";
|
|
3300
3397
|
const produce2 = (proxies, type2, opts = {}) => {
|
|
3301
3398
|
const list = proxies.filter((proxy) => {
|
|
3302
|
-
if (opts["include-unsupported-proxy"]) return true;
|
|
3303
3399
|
if (![
|
|
3304
3400
|
"ss",
|
|
3305
3401
|
"ssr",
|
|
@@ -3329,7 +3425,11 @@ function Stash_Producer() {
|
|
|
3329
3425
|
"chacha20-ietf",
|
|
3330
3426
|
"xchacha20",
|
|
3331
3427
|
"chacha20-ietf-poly1305",
|
|
3332
|
-
"xchacha20-ietf-poly1305"
|
|
3428
|
+
"xchacha20-ietf-poly1305",
|
|
3429
|
+
...opts["include-unsupported-proxy"] ? [
|
|
3430
|
+
"2022-blake3-aes-128-gcm",
|
|
3431
|
+
"2022-blake3-aes-256-gcm"
|
|
3432
|
+
] : []
|
|
3333
3433
|
].includes(proxy.cipher) || proxy.type === "snell" && String(proxy.version) === "4" || proxy.type === "vless" && proxy["reality-opts"]) {
|
|
3334
3434
|
return false;
|
|
3335
3435
|
}
|
|
@@ -3493,6 +3593,7 @@ function Stash_Producer() {
|
|
|
3493
3593
|
}
|
|
3494
3594
|
if (["grpc"].includes(proxy.network) && proxy[`${proxy.network}-opts`]) {
|
|
3495
3595
|
delete proxy[`${proxy.network}-opts`]["_grpc-type"];
|
|
3596
|
+
delete proxy[`${proxy.network}-opts`]["_grpc-authority"];
|
|
3496
3597
|
}
|
|
3497
3598
|
return proxy;
|
|
3498
3599
|
});
|
|
@@ -3501,13 +3602,13 @@ function Stash_Producer() {
|
|
|
3501
3602
|
return { type, produce: produce2 };
|
|
3502
3603
|
}
|
|
3503
3604
|
|
|
3504
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/loon.js
|
|
3605
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/loon.js
|
|
3505
3606
|
var targetPlatform3 = "Loon";
|
|
3506
3607
|
function Loon_Producer() {
|
|
3507
|
-
const produce2 = (proxy) => {
|
|
3608
|
+
const produce2 = (proxy, type, opts = {}) => {
|
|
3508
3609
|
switch (proxy.type) {
|
|
3509
3610
|
case "ss":
|
|
3510
|
-
return shadowsocks2(proxy);
|
|
3611
|
+
return shadowsocks2(proxy, opts["include-unsupported-proxy"]);
|
|
3511
3612
|
case "ssr":
|
|
3512
3613
|
return shadowsocksr(proxy);
|
|
3513
3614
|
case "trojan":
|
|
@@ -3531,7 +3632,7 @@ function Loon_Producer() {
|
|
|
3531
3632
|
};
|
|
3532
3633
|
return { produce: produce2 };
|
|
3533
3634
|
}
|
|
3534
|
-
function shadowsocks2(proxy) {
|
|
3635
|
+
function shadowsocks2(proxy, includeUnsupportedProxy) {
|
|
3535
3636
|
const result = new Result(proxy);
|
|
3536
3637
|
if (![
|
|
3537
3638
|
"rc4",
|
|
@@ -3553,7 +3654,8 @@ function shadowsocks2(proxy) {
|
|
|
3553
3654
|
"aes-192-gcm",
|
|
3554
3655
|
"aes-256-gcm",
|
|
3555
3656
|
"chacha20-ietf-poly1305",
|
|
3556
|
-
"xchacha20-ietf-poly1305"
|
|
3657
|
+
"xchacha20-ietf-poly1305",
|
|
3658
|
+
...includeUnsupportedProxy ? ["2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm"] : []
|
|
3557
3659
|
].includes(proxy.cipher)) {
|
|
3558
3660
|
throw new Error(`cipher ${proxy.cipher} is not supported`);
|
|
3559
3661
|
}
|
|
@@ -3880,7 +3982,7 @@ function hysteria22(proxy) {
|
|
|
3880
3982
|
return result.toString();
|
|
3881
3983
|
}
|
|
3882
3984
|
|
|
3883
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/uri.js
|
|
3985
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/uri.js
|
|
3884
3986
|
import { Base64 as Base643 } from "js-base64";
|
|
3885
3987
|
function URI_Producer() {
|
|
3886
3988
|
const type = "SINGLE";
|
|
@@ -3907,7 +4009,9 @@ function URI_Producer() {
|
|
|
3907
4009
|
switch (proxy.type) {
|
|
3908
4010
|
case "ss":
|
|
3909
4011
|
const userinfo = `${proxy.cipher}:${proxy.password}`;
|
|
3910
|
-
result = `ss://${
|
|
4012
|
+
result = `ss://${proxy.cipher?.startsWith("2022-blake3-") ? `${encodeURIComponent(
|
|
4013
|
+
proxy.cipher
|
|
4014
|
+
)}:${encodeURIComponent(proxy.password)}` : Base643.encode(userinfo)}@${proxy.server}:${proxy.port}${proxy.plugin ? "/" : ""}`;
|
|
3911
4015
|
if (proxy.plugin) {
|
|
3912
4016
|
result += "?plugin=";
|
|
3913
4017
|
const opts = proxy["plugin-opts"];
|
|
@@ -3957,7 +4061,7 @@ function URI_Producer() {
|
|
|
3957
4061
|
port: proxy.port,
|
|
3958
4062
|
id: proxy.uuid,
|
|
3959
4063
|
type: type2,
|
|
3960
|
-
aid: 0,
|
|
4064
|
+
aid: proxy.alterId || 0,
|
|
3961
4065
|
net,
|
|
3962
4066
|
tls: proxy.tls ? "tls" : ""
|
|
3963
4067
|
};
|
|
@@ -3976,6 +4080,7 @@ function URI_Producer() {
|
|
|
3976
4080
|
if (["grpc"].includes(proxy.network)) {
|
|
3977
4081
|
result.path = proxy[`${proxy.network}-opts`]?.["grpc-service-name"];
|
|
3978
4082
|
result.type = proxy[`${proxy.network}-opts`]?.["_grpc-type"] || "gun";
|
|
4083
|
+
result.host = proxy[`${proxy.network}-opts`]?.["_grpc-authority"];
|
|
3979
4084
|
}
|
|
3980
4085
|
}
|
|
3981
4086
|
result = "vmess://" + Base643.encode(JSON.stringify(result));
|
|
@@ -4031,6 +4136,12 @@ function URI_Producer() {
|
|
|
4031
4136
|
vlessTransport += `&mode=${encodeURIComponent(
|
|
4032
4137
|
proxy[`${proxy.network}-opts`]?.["_grpc-type"] || "gun"
|
|
4033
4138
|
)}`;
|
|
4139
|
+
const authority = proxy[`${proxy.network}-opts`]?.["_grpc-authority"];
|
|
4140
|
+
if (authority) {
|
|
4141
|
+
vlessTransport += `&authority=${encodeURIComponent(
|
|
4142
|
+
authority
|
|
4143
|
+
)}`;
|
|
4144
|
+
}
|
|
4034
4145
|
}
|
|
4035
4146
|
let vlessTransportServiceName = proxy[`${proxy.network}-opts`]?.[`${proxy.network}-service-name`];
|
|
4036
4147
|
let vlessTransportPath = proxy[`${proxy.network}-opts`]?.path;
|
|
@@ -4078,11 +4189,17 @@ function URI_Producer() {
|
|
|
4078
4189
|
trojanTransport = `&type=${encodeURIComponent(trojanType)}`;
|
|
4079
4190
|
if (["grpc"].includes(proxy.network)) {
|
|
4080
4191
|
let trojanTransportServiceName = proxy[`${proxy.network}-opts`]?.[`${proxy.network}-service-name`];
|
|
4192
|
+
let trojanTransportAuthority = proxy[`${proxy.network}-opts`]?.["_grpc-authority"];
|
|
4081
4193
|
if (trojanTransportServiceName) {
|
|
4082
4194
|
trojanTransport += `&serviceName=${encodeURIComponent(
|
|
4083
4195
|
trojanTransportServiceName
|
|
4084
4196
|
)}`;
|
|
4085
4197
|
}
|
|
4198
|
+
if (trojanTransportAuthority) {
|
|
4199
|
+
trojanTransport += `&authority=${encodeURIComponent(
|
|
4200
|
+
trojanTransportAuthority
|
|
4201
|
+
)}`;
|
|
4202
|
+
}
|
|
4086
4203
|
trojanTransport += `&mode=${encodeURIComponent(
|
|
4087
4204
|
proxy[`${proxy.network}-opts`]?.["_grpc-type"] || "gun"
|
|
4088
4205
|
)}`;
|
|
@@ -4100,7 +4217,21 @@ function URI_Producer() {
|
|
|
4100
4217
|
)}`;
|
|
4101
4218
|
}
|
|
4102
4219
|
}
|
|
4103
|
-
|
|
4220
|
+
let trojanFp = "";
|
|
4221
|
+
if (proxy["client-fingerprint"]) {
|
|
4222
|
+
trojanFp = `&fp=${encodeURIComponent(
|
|
4223
|
+
proxy["client-fingerprint"]
|
|
4224
|
+
)}`;
|
|
4225
|
+
}
|
|
4226
|
+
let trojanAlpn = "";
|
|
4227
|
+
if (proxy.alpn) {
|
|
4228
|
+
trojanAlpn = `&alpn=${encodeURIComponent(
|
|
4229
|
+
Array.isArray(proxy.alpn) ? proxy.alpn : proxy.alpn.join(",")
|
|
4230
|
+
)}`;
|
|
4231
|
+
}
|
|
4232
|
+
result = `trojan://${proxy.password}@${proxy.server}:${proxy.port}?sni=${encodeURIComponent(proxy.sni || proxy.server)}${proxy["skip-cert-verify"] ? "&allowInsecure=1" : ""}${trojanTransport}${trojanAlpn}${trojanFp}#${encodeURIComponent(
|
|
4233
|
+
proxy.name
|
|
4234
|
+
)}`;
|
|
4104
4235
|
break;
|
|
4105
4236
|
case "hysteria2":
|
|
4106
4237
|
let hysteria2params = [];
|
|
@@ -4278,7 +4409,7 @@ function URI_Producer() {
|
|
|
4278
4409
|
return { type, produce: produce2 };
|
|
4279
4410
|
}
|
|
4280
4411
|
|
|
4281
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/v2ray.js
|
|
4412
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/v2ray.js
|
|
4282
4413
|
import { Base64 as Base644 } from "js-base64";
|
|
4283
4414
|
var URI = URI_Producer();
|
|
4284
4415
|
function V2Ray_Producer() {
|
|
@@ -4304,7 +4435,7 @@ Reason: ${err}`
|
|
|
4304
4435
|
return { type, produce: produce2 };
|
|
4305
4436
|
}
|
|
4306
4437
|
|
|
4307
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/qx.js
|
|
4438
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/qx.js
|
|
4308
4439
|
var targetPlatform4 = "QX";
|
|
4309
4440
|
function QX_Producer() {
|
|
4310
4441
|
const produce2 = (proxy, type, opts = {}) => {
|
|
@@ -4739,7 +4870,7 @@ function needTls(proxy) {
|
|
|
4739
4870
|
return proxy.tls;
|
|
4740
4871
|
}
|
|
4741
4872
|
|
|
4742
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/shadowrocket.js
|
|
4873
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/shadowrocket.js
|
|
4743
4874
|
function ShadowRocket_Producer() {
|
|
4744
4875
|
const type = "ALL";
|
|
4745
4876
|
const produce2 = (proxies, type2, opts = {}) => {
|
|
@@ -4747,6 +4878,8 @@ function ShadowRocket_Producer() {
|
|
|
4747
4878
|
if (opts["include-unsupported-proxy"]) return true;
|
|
4748
4879
|
if (proxy.type === "snell" && String(proxy.version) === "4") {
|
|
4749
4880
|
return false;
|
|
4881
|
+
} else if (["mieru"].includes(proxy.type)) {
|
|
4882
|
+
return false;
|
|
4750
4883
|
}
|
|
4751
4884
|
return true;
|
|
4752
4885
|
}).map((proxy) => {
|
|
@@ -4872,6 +5005,7 @@ function ShadowRocket_Producer() {
|
|
|
4872
5005
|
}
|
|
4873
5006
|
if (["grpc"].includes(proxy.network) && proxy[`${proxy.network}-opts`]) {
|
|
4874
5007
|
delete proxy[`${proxy.network}-opts`]["_grpc-type"];
|
|
5008
|
+
delete proxy[`${proxy.network}-opts`]["_grpc-authority"];
|
|
4875
5009
|
}
|
|
4876
5010
|
return proxy;
|
|
4877
5011
|
});
|
|
@@ -4882,7 +5016,7 @@ function ShadowRocket_Producer() {
|
|
|
4882
5016
|
return { type, produce: produce2 };
|
|
4883
5017
|
}
|
|
4884
5018
|
|
|
4885
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/surfboard.js
|
|
5019
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/surfboard.js
|
|
4886
5020
|
var targetPlatform5 = "Surfboard";
|
|
4887
5021
|
function Surfboard_Producer() {
|
|
4888
5022
|
const produce2 = (proxy) => {
|
|
@@ -5054,9 +5188,9 @@ function handleTransport2(result, proxy) {
|
|
|
5054
5188
|
}
|
|
5055
5189
|
}
|
|
5056
5190
|
|
|
5057
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/sing-box.js
|
|
5191
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/sing-box.js
|
|
5058
5192
|
var detourParser = (proxy, parsedProxy) => {
|
|
5059
|
-
|
|
5193
|
+
parsedProxy.detour = proxy["dialer-proxy"] || proxy.detour;
|
|
5060
5194
|
};
|
|
5061
5195
|
var tfoParser = (proxy, parsedProxy) => {
|
|
5062
5196
|
parsedProxy.tcp_fast_open = false;
|
|
@@ -5257,7 +5391,7 @@ var tlsParser = (proxy, parsedProxy) => {
|
|
|
5257
5391
|
parsedProxy.tls.reality.short_id = proxy["reality-opts"]["short-id"];
|
|
5258
5392
|
parsedProxy.tls.utls = { enabled: true };
|
|
5259
5393
|
}
|
|
5260
|
-
if (proxy["client-fingerprint"] && proxy["client-fingerprint"] !== "")
|
|
5394
|
+
if (!["hysteria", "hysteria2", "tuic"].includes(proxy.type) && proxy["client-fingerprint"] && proxy["client-fingerprint"] !== "")
|
|
5261
5395
|
parsedProxy.tls.utls = {
|
|
5262
5396
|
enabled: true,
|
|
5263
5397
|
fingerprint: proxy["client-fingerprint"]
|
|
@@ -5588,7 +5722,7 @@ var hysteriaParser = (proxy = {}) => {
|
|
|
5588
5722
|
smuxParser(proxy.smux, parsedProxy);
|
|
5589
5723
|
return parsedProxy;
|
|
5590
5724
|
};
|
|
5591
|
-
var hysteria2Parser = (proxy = {}) => {
|
|
5725
|
+
var hysteria2Parser = (proxy = {}, includeUnsupportedProxy) => {
|
|
5592
5726
|
const parsedProxy = {
|
|
5593
5727
|
tag: proxy.name,
|
|
5594
5728
|
type: "hysteria2",
|
|
@@ -5600,6 +5734,12 @@ var hysteria2Parser = (proxy = {}) => {
|
|
|
5600
5734
|
};
|
|
5601
5735
|
if (parsedProxy.server_port < 0 || parsedProxy.server_port > 65535)
|
|
5602
5736
|
throw "invalid port";
|
|
5737
|
+
if (includeUnsupportedProxy) {
|
|
5738
|
+
if (proxy["hop-interval"])
|
|
5739
|
+
parsedProxy.hop_interval = /^\d+$/.test(proxy["hop-interval"]) ? `${proxy["hop-interval"]}s` : proxy["hop-interval"];
|
|
5740
|
+
if (proxy["ports"])
|
|
5741
|
+
parsedProxy.server_ports = proxy["ports"].split(/\s*,\s*/).map((p) => p.replace(/\s*-\s*/g, ":"));
|
|
5742
|
+
}
|
|
5603
5743
|
if (proxy.up) parsedProxy.up_mbps = parseInt(`${proxy.up}`, 10);
|
|
5604
5744
|
if (proxy.down) parsedProxy.down_mbps = parseInt(`${proxy.down}`, 10);
|
|
5605
5745
|
if (proxy.obfs === "salamander") parsedProxy.obfs.type = "salamander";
|
|
@@ -5764,7 +5904,12 @@ function singbox_Producer() {
|
|
|
5764
5904
|
list.push(hysteriaParser(proxy));
|
|
5765
5905
|
break;
|
|
5766
5906
|
case "hysteria2":
|
|
5767
|
-
list.push(
|
|
5907
|
+
list.push(
|
|
5908
|
+
hysteria2Parser(
|
|
5909
|
+
proxy,
|
|
5910
|
+
opts["include-unsupported-proxy"]
|
|
5911
|
+
)
|
|
5912
|
+
);
|
|
5768
5913
|
break;
|
|
5769
5914
|
case "tuic":
|
|
5770
5915
|
if (!proxy.token || proxy.token.length === 0) {
|
|
@@ -5792,7 +5937,266 @@ function singbox_Producer() {
|
|
|
5792
5937
|
return { type, produce: produce2 };
|
|
5793
5938
|
}
|
|
5794
5939
|
|
|
5795
|
-
// Sub-Store/backend/src/core/proxy-utils/producers/
|
|
5940
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/egern.js
|
|
5941
|
+
function Egern_Producer() {
|
|
5942
|
+
const type = "ALL";
|
|
5943
|
+
const produce2 = (proxies, type2, opts = {}) => {
|
|
5944
|
+
const list = proxies.filter((proxy) => {
|
|
5945
|
+
if (opts["include-unsupported-proxy"]) return true;
|
|
5946
|
+
if (![
|
|
5947
|
+
"http",
|
|
5948
|
+
"socks5",
|
|
5949
|
+
"ss",
|
|
5950
|
+
"trojan",
|
|
5951
|
+
"hysteria2",
|
|
5952
|
+
"vless",
|
|
5953
|
+
"vmess"
|
|
5954
|
+
].includes(proxy.type) || proxy.type === "ss" && (proxy.plugin === "obfs" && !["http", "tls"].includes(
|
|
5955
|
+
proxy["plugin-opts"]?.mode
|
|
5956
|
+
) || ![
|
|
5957
|
+
"chacha20-ietf-poly1305",
|
|
5958
|
+
"chacha20-poly1305",
|
|
5959
|
+
"aes-256-gcm",
|
|
5960
|
+
"aes-128-gcm",
|
|
5961
|
+
"none",
|
|
5962
|
+
"tbale",
|
|
5963
|
+
"rc4",
|
|
5964
|
+
"rc4-md5",
|
|
5965
|
+
"aes-128-cfb",
|
|
5966
|
+
"aes-192-cfb",
|
|
5967
|
+
"aes-256-cfb",
|
|
5968
|
+
"aes-128-ctr",
|
|
5969
|
+
"aes-192-ctr",
|
|
5970
|
+
"aes-256-ctr",
|
|
5971
|
+
"bf-cfb",
|
|
5972
|
+
"camellia-128-cfb",
|
|
5973
|
+
"camellia-192-cfb",
|
|
5974
|
+
"camellia-256-cfb",
|
|
5975
|
+
"cast5-cfb",
|
|
5976
|
+
"des-cfb",
|
|
5977
|
+
"idea-cfb",
|
|
5978
|
+
"rc2-cfb",
|
|
5979
|
+
"seed-cfb",
|
|
5980
|
+
"salsa20",
|
|
5981
|
+
"chacha20",
|
|
5982
|
+
"chacha20-ietf"
|
|
5983
|
+
].includes(proxy.cipher)) || proxy.type === "vmess" && (![
|
|
5984
|
+
"auto",
|
|
5985
|
+
"aes-128-gcm",
|
|
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)) {
|
|
5990
|
+
return false;
|
|
5991
|
+
}
|
|
5992
|
+
return true;
|
|
5993
|
+
}).map((proxy) => {
|
|
5994
|
+
if (proxy.tls && !proxy.sni) {
|
|
5995
|
+
proxy.sni = proxy.server;
|
|
5996
|
+
}
|
|
5997
|
+
const prev_hop = proxy.prev_hop || proxy["underlying-proxy"] || proxy["dialer-proxy"] || proxy.detour;
|
|
5998
|
+
if (proxy.type === "http") {
|
|
5999
|
+
proxy = {
|
|
6000
|
+
type: "http",
|
|
6001
|
+
name: proxy.name,
|
|
6002
|
+
server: proxy.server,
|
|
6003
|
+
port: proxy.port,
|
|
6004
|
+
username: proxy.username,
|
|
6005
|
+
password: proxy.password,
|
|
6006
|
+
tfo: proxy.tfo || proxy["fast-open"],
|
|
6007
|
+
next_hop: proxy.next_hop
|
|
6008
|
+
};
|
|
6009
|
+
} else if (proxy.type === "socks5") {
|
|
6010
|
+
proxy = {
|
|
6011
|
+
type: "socks5",
|
|
6012
|
+
name: proxy.name,
|
|
6013
|
+
server: proxy.server,
|
|
6014
|
+
port: proxy.port,
|
|
6015
|
+
username: proxy.username,
|
|
6016
|
+
password: proxy.password,
|
|
6017
|
+
tfo: proxy.tfo || proxy["fast-open"],
|
|
6018
|
+
udp_relay: proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
|
6019
|
+
next_hop: proxy.next_hop
|
|
6020
|
+
};
|
|
6021
|
+
} else if (proxy.type === "ss") {
|
|
6022
|
+
proxy = {
|
|
6023
|
+
type: "shadowsocks",
|
|
6024
|
+
name: proxy.name,
|
|
6025
|
+
method: proxy.cipher === "chacha20-ietf-poly1305" ? "chacha20-poly1305" : proxy.cipher,
|
|
6026
|
+
server: proxy.server,
|
|
6027
|
+
port: proxy.port,
|
|
6028
|
+
password: proxy.password,
|
|
6029
|
+
tfo: proxy.tfo || proxy["fast-open"],
|
|
6030
|
+
udp_relay: proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
|
6031
|
+
next_hop: proxy.next_hop
|
|
6032
|
+
};
|
|
6033
|
+
if (proxy.plugin === "obfs") {
|
|
6034
|
+
proxy.obfs = proxy["plugin-opts"].mode;
|
|
6035
|
+
proxy.obfs_host = proxy["plugin-opts"].host;
|
|
6036
|
+
proxy.obfs_uri = proxy["plugin-opts"].path;
|
|
6037
|
+
}
|
|
6038
|
+
} else if (proxy.type === "hysteria2") {
|
|
6039
|
+
proxy = {
|
|
6040
|
+
type: "hysteria2",
|
|
6041
|
+
name: proxy.name,
|
|
6042
|
+
server: proxy.server,
|
|
6043
|
+
port: proxy.port,
|
|
6044
|
+
auth: proxy.password,
|
|
6045
|
+
tfo: proxy.tfo || proxy["fast-open"],
|
|
6046
|
+
udp_relay: proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
|
6047
|
+
next_hop: proxy.next_hop,
|
|
6048
|
+
sni: proxy.sni,
|
|
6049
|
+
skip_tls_verify: proxy["skip-cert-verify"],
|
|
6050
|
+
port_hopping: proxy.ports,
|
|
6051
|
+
port_hopping_interval: proxy["hop-interval"]
|
|
6052
|
+
};
|
|
6053
|
+
if (proxy["obfs-password"] && proxy.obfs == "salamander") {
|
|
6054
|
+
proxy.obfs = "salamander";
|
|
6055
|
+
proxy.obfs_password = proxy["obfs-password"];
|
|
6056
|
+
}
|
|
6057
|
+
} else if (proxy.type === "trojan") {
|
|
6058
|
+
if (proxy.network === "ws") {
|
|
6059
|
+
proxy.websocket = {
|
|
6060
|
+
path: proxy["ws-opts"]?.path,
|
|
6061
|
+
host: proxy["ws-opts"]?.headers?.Host
|
|
6062
|
+
};
|
|
6063
|
+
}
|
|
6064
|
+
proxy = {
|
|
6065
|
+
type: "trojan",
|
|
6066
|
+
name: proxy.name,
|
|
6067
|
+
server: proxy.server,
|
|
6068
|
+
port: proxy.port,
|
|
6069
|
+
password: proxy.password,
|
|
6070
|
+
tfo: proxy.tfo || proxy["fast-open"],
|
|
6071
|
+
udp_relay: proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
|
6072
|
+
next_hop: proxy.next_hop,
|
|
6073
|
+
sni: proxy.sni,
|
|
6074
|
+
skip_tls_verify: proxy["skip-cert-verify"],
|
|
6075
|
+
websocket: proxy.websocket
|
|
6076
|
+
};
|
|
6077
|
+
} else if (proxy.type === "vmess") {
|
|
6078
|
+
if (proxy.network === "ws") {
|
|
6079
|
+
proxy.transport = {
|
|
6080
|
+
[proxy.tls ? "wss" : "ws"]: {
|
|
6081
|
+
path: proxy["ws-opts"]?.path,
|
|
6082
|
+
headers: {
|
|
6083
|
+
Host: proxy["ws-opts"]?.headers?.Host
|
|
6084
|
+
},
|
|
6085
|
+
sni: proxy.tls ? proxy.sni : void 0,
|
|
6086
|
+
skip_tls_verify: proxy.tls ? proxy["skip-cert-verify"] : void 0
|
|
6087
|
+
}
|
|
6088
|
+
};
|
|
6089
|
+
} else if (proxy.network === "http") {
|
|
6090
|
+
proxy.transport = {
|
|
6091
|
+
http: {
|
|
6092
|
+
method: proxy["http-opts"]?.method,
|
|
6093
|
+
path: proxy["http-opts"]?.path,
|
|
6094
|
+
headers: {
|
|
6095
|
+
Host: Array.isArray(
|
|
6096
|
+
proxy["http-opts"]?.headers?.Host
|
|
6097
|
+
) ? proxy["http-opts"]?.headers?.Host[0] : proxy["http-opts"]?.headers?.Host
|
|
6098
|
+
},
|
|
6099
|
+
skip_tls_verify: proxy["skip-cert-verify"]
|
|
6100
|
+
}
|
|
6101
|
+
};
|
|
6102
|
+
} else if (proxy.network === "tcp" || !proxy.network) {
|
|
6103
|
+
proxy.transport = {
|
|
6104
|
+
[proxy.tls ? "tls" : "tcp"]: {
|
|
6105
|
+
sni: proxy.tls ? proxy.sni : void 0,
|
|
6106
|
+
skip_tls_verify: proxy.tls ? proxy["skip-cert-verify"] : void 0
|
|
6107
|
+
}
|
|
6108
|
+
};
|
|
6109
|
+
}
|
|
6110
|
+
proxy = {
|
|
6111
|
+
type: "vmess",
|
|
6112
|
+
name: proxy.name,
|
|
6113
|
+
server: proxy.server,
|
|
6114
|
+
port: proxy.port,
|
|
6115
|
+
user_id: proxy.uuid,
|
|
6116
|
+
security: proxy.cipher,
|
|
6117
|
+
tfo: proxy.tfo || proxy["fast-open"],
|
|
6118
|
+
legacy: proxy.legacy,
|
|
6119
|
+
udp_relay: proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
|
6120
|
+
next_hop: proxy.next_hop,
|
|
6121
|
+
transport: proxy.transport
|
|
6122
|
+
// sni: proxy.sni,
|
|
6123
|
+
// skip_tls_verify: proxy['skip-cert-verify'],
|
|
6124
|
+
};
|
|
6125
|
+
} else if (proxy.type === "vless") {
|
|
6126
|
+
if (proxy.network === "ws") {
|
|
6127
|
+
proxy.transport = {
|
|
6128
|
+
[proxy.tls ? "wss" : "ws"]: {
|
|
6129
|
+
path: proxy["ws-opts"]?.path,
|
|
6130
|
+
headers: {
|
|
6131
|
+
Host: proxy["ws-opts"]?.headers?.Host
|
|
6132
|
+
},
|
|
6133
|
+
sni: proxy.tls ? proxy.sni : void 0,
|
|
6134
|
+
skip_tls_verify: proxy.tls ? proxy["skip-cert-verify"] : void 0
|
|
6135
|
+
}
|
|
6136
|
+
};
|
|
6137
|
+
} else if (proxy.network === "http") {
|
|
6138
|
+
proxy.transport = {
|
|
6139
|
+
http: {
|
|
6140
|
+
method: proxy["http-opts"]?.method,
|
|
6141
|
+
path: proxy["http-opts"]?.path,
|
|
6142
|
+
headers: {
|
|
6143
|
+
Host: Array.isArray(
|
|
6144
|
+
proxy["http-opts"]?.headers?.Host
|
|
6145
|
+
) ? proxy["http-opts"]?.headers?.Host[0] : proxy["http-opts"]?.headers?.Host
|
|
6146
|
+
},
|
|
6147
|
+
skip_tls_verify: proxy["skip-cert-verify"]
|
|
6148
|
+
}
|
|
6149
|
+
};
|
|
6150
|
+
} else if (proxy.network === "tcp" || !proxy.network) {
|
|
6151
|
+
proxy.transport = {
|
|
6152
|
+
[proxy.tls ? "tls" : "tcp"]: {
|
|
6153
|
+
sni: proxy.tls ? proxy.sni : void 0,
|
|
6154
|
+
skip_tls_verify: proxy.tls ? proxy["skip-cert-verify"] : void 0
|
|
6155
|
+
}
|
|
6156
|
+
};
|
|
6157
|
+
}
|
|
6158
|
+
proxy = {
|
|
6159
|
+
type: "vless",
|
|
6160
|
+
name: proxy.name,
|
|
6161
|
+
server: proxy.server,
|
|
6162
|
+
port: proxy.port,
|
|
6163
|
+
user_id: proxy.uuid,
|
|
6164
|
+
security: proxy.cipher,
|
|
6165
|
+
tfo: proxy.tfo || proxy["fast-open"],
|
|
6166
|
+
legacy: proxy.legacy,
|
|
6167
|
+
udp_relay: proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
|
6168
|
+
next_hop: proxy.next_hop,
|
|
6169
|
+
transport: proxy.transport
|
|
6170
|
+
// sni: proxy.sni,
|
|
6171
|
+
// skip_tls_verify: proxy['skip-cert-verify'],
|
|
6172
|
+
};
|
|
6173
|
+
}
|
|
6174
|
+
delete proxy.subName;
|
|
6175
|
+
delete proxy.collectionName;
|
|
6176
|
+
delete proxy.id;
|
|
6177
|
+
delete proxy.resolved;
|
|
6178
|
+
delete proxy["no-resolve"];
|
|
6179
|
+
if (type2 !== "internal") {
|
|
6180
|
+
for (const key in proxy) {
|
|
6181
|
+
if (proxy[key] == null || /^_/i.test(key)) {
|
|
6182
|
+
delete proxy[key];
|
|
6183
|
+
}
|
|
6184
|
+
}
|
|
6185
|
+
}
|
|
6186
|
+
return {
|
|
6187
|
+
[proxy.type]: {
|
|
6188
|
+
...proxy,
|
|
6189
|
+
type: void 0,
|
|
6190
|
+
prev_hop
|
|
6191
|
+
}
|
|
6192
|
+
};
|
|
6193
|
+
});
|
|
6194
|
+
return type2 === "internal" ? list : "proxies:\n" + list.map((proxy) => " - " + JSON.stringify(proxy) + "\n").join("");
|
|
6195
|
+
};
|
|
6196
|
+
return { type, produce: produce2 };
|
|
6197
|
+
}
|
|
6198
|
+
|
|
6199
|
+
// src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/index.js
|
|
5796
6200
|
function JSON_Producer() {
|
|
5797
6201
|
const type = "ALL";
|
|
5798
6202
|
const produce2 = (proxies, type2) => type2 === "internal" ? proxies : JSON.stringify(proxies, null, 2);
|
|
@@ -5813,7 +6217,8 @@ var producers_default = {
|
|
|
5813
6217
|
Shadowrocket: ShadowRocket_Producer(),
|
|
5814
6218
|
ShadowRocket: ShadowRocket_Producer(),
|
|
5815
6219
|
Surfboard: Surfboard_Producer(),
|
|
5816
|
-
"sing-box": singbox_Producer()
|
|
6220
|
+
"sing-box": singbox_Producer(),
|
|
6221
|
+
Egern: Egern_Producer()
|
|
5817
6222
|
};
|
|
5818
6223
|
|
|
5819
6224
|
// src/index.js
|