sub-store-convert 2.24.19 → 2.24.22
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/index.js +55 -46
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -438,7 +438,7 @@ ssh = tag equals "ssh" address (username password)? (usernamek passwordk)? (serv
|
|
|
438
438
|
proxy.type = "ssh";
|
|
439
439
|
handleShadowTLS();
|
|
440
440
|
}
|
|
441
|
-
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)* {
|
|
441
|
+
snell = tag equals "snell" address (snell_version/snell_mode/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)* {
|
|
442
442
|
proxy.type = "snell";
|
|
443
443
|
// handle obfs
|
|
444
444
|
if (obfs.type == "http" || obfs.type === "tls") {
|
|
@@ -561,6 +561,12 @@ client_cert = comma "client-cert" equals match:[^,]+ { proxy["keystore-client-ce
|
|
|
561
561
|
|
|
562
562
|
snell_psk = comma "psk" equals match:[^,]+ { proxy.psk = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
|
563
563
|
snell_version = comma "version" equals match:$[0-9]+ { proxy.version = parseInt(match.trim()); }
|
|
564
|
+
snell_mode = comma "mode" equals match:[^,]+ {
|
|
565
|
+
const mode = stripQuotes(match.join("")).trim();
|
|
566
|
+
if (["default", "unshaped", "unsafe-raw"].includes(mode)) {
|
|
567
|
+
proxy.mode = mode;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
564
570
|
|
|
565
571
|
usernamek = comma "username" equals match:[^,]+ { proxy.username = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
|
566
572
|
passwordk = comma "password" equals match:[^,]+ { proxy.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
|
@@ -730,11 +736,11 @@ vless = tag equals "vless"i address uuid (transport/transport_host/transport_pat
|
|
|
730
736
|
proxy.type = "vless";
|
|
731
737
|
handleTransport();
|
|
732
738
|
}
|
|
733
|
-
trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/block_quic/others)* {
|
|
739
|
+
trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/others)* {
|
|
734
740
|
proxy.type = "trojan";
|
|
735
741
|
handleTransport();
|
|
736
742
|
}
|
|
737
|
-
anytls = tag equals "anytls"i address password (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/block_quic/idle_session_check_interval/idle_session_timeout/min_idle_session/max_stream_count/others)* {
|
|
743
|
+
anytls = tag equals "anytls"i address password (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/idle_session_check_interval/idle_session_timeout/min_idle_session/max_stream_count/others)* {
|
|
738
744
|
proxy.type = "anytls";
|
|
739
745
|
handleTransport();
|
|
740
746
|
}
|
|
@@ -5479,6 +5485,9 @@ function snell(proxy) {
|
|
|
5479
5485
|
result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
|
|
5480
5486
|
result.appendIfPresent(`,version=${proxy.version}`, "version");
|
|
5481
5487
|
result.appendIfPresent(`,psk="${proxy.psk}"`, "psk");
|
|
5488
|
+
if (Number(proxy.version) === 6) {
|
|
5489
|
+
result.appendIfPresent(`,mode=${proxy.mode}`, "mode");
|
|
5490
|
+
}
|
|
5482
5491
|
const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
|
|
5483
5492
|
result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
|
|
5484
5493
|
result.appendIfPresent(
|
|
@@ -6773,9 +6782,9 @@ function Loon_Producer() {
|
|
|
6773
6782
|
return hysteria22(proxy);
|
|
6774
6783
|
}
|
|
6775
6784
|
if (proxy.type === "anytls") {
|
|
6776
|
-
if (proxy.network &&
|
|
6785
|
+
if (proxy.network && !["tcp"].includes(proxy.network)) {
|
|
6777
6786
|
throw new Error(
|
|
6778
|
-
`Platform ${targetPlatform3} does not support proxy type ${proxy.type} with network
|
|
6787
|
+
`Platform ${targetPlatform3} does not support proxy type ${proxy.type} with network ${proxy.network}`
|
|
6779
6788
|
);
|
|
6780
6789
|
}
|
|
6781
6790
|
return anytls2(proxy);
|
|
@@ -6794,6 +6803,17 @@ function appendAlpn(result, proxy) {
|
|
|
6794
6803
|
const alpn = getLoonAlpn(proxy);
|
|
6795
6804
|
if (alpn) result.append(`,alpn="${alpn}"`);
|
|
6796
6805
|
}
|
|
6806
|
+
function appendReality(result, proxy) {
|
|
6807
|
+
result.appendIfPresent(`,sni=${proxy.sni}`, "sni");
|
|
6808
|
+
result.appendIfPresent(
|
|
6809
|
+
`,public-key="${proxy["reality-opts"]["public-key"]}"`,
|
|
6810
|
+
"reality-opts.public-key"
|
|
6811
|
+
);
|
|
6812
|
+
result.appendIfPresent(
|
|
6813
|
+
`,short-id=${proxy["reality-opts"]["short-id"]}`,
|
|
6814
|
+
"reality-opts.short-id"
|
|
6815
|
+
);
|
|
6816
|
+
}
|
|
6797
6817
|
function getLoonAlpn(proxy) {
|
|
6798
6818
|
const values = Array.isArray(proxy.alpn) ? proxy.alpn : `${proxy.alpn || ""}`.split(",");
|
|
6799
6819
|
return values.map((item) => `${item}`.trim()).filter((item) => item !== "").join(",");
|
|
@@ -6843,11 +6863,6 @@ function shadowsocks2(proxy) {
|
|
|
6843
6863
|
);
|
|
6844
6864
|
if (isPresent2(proxy, "plugin")) {
|
|
6845
6865
|
if (proxy.plugin === "obfs") {
|
|
6846
|
-
if (proxy["plugin-opts"]?.mode && proxy.cipher.startsWith("2022-")) {
|
|
6847
|
-
throw new Error(
|
|
6848
|
-
`${proxy.cipher} ${proxy.plugin} is not supported`
|
|
6849
|
-
);
|
|
6850
|
-
}
|
|
6851
6866
|
result.append(`,obfs-name=${proxy["plugin-opts"].mode}`);
|
|
6852
6867
|
result.appendIfPresent(
|
|
6853
6868
|
`,obfs-host=${proxy["plugin-opts"].host}`,
|
|
@@ -6983,6 +6998,7 @@ function shadowsocksr(proxy) {
|
|
|
6983
6998
|
return result.toString();
|
|
6984
6999
|
}
|
|
6985
7000
|
function trojan2(proxy) {
|
|
7001
|
+
const isReality = !!proxy["reality-opts"];
|
|
6986
7002
|
const result = new Result(proxy);
|
|
6987
7003
|
result.append(
|
|
6988
7004
|
`${proxy.name}=trojan,${proxy.server},${proxy.port},"${proxy.password}"`
|
|
@@ -7011,15 +7027,19 @@ function trojan2(proxy) {
|
|
|
7011
7027
|
);
|
|
7012
7028
|
appendTlsProfile(result, proxy);
|
|
7013
7029
|
appendAlpn(result, proxy);
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7030
|
+
if (isReality) {
|
|
7031
|
+
appendReality(result, proxy);
|
|
7032
|
+
} else {
|
|
7033
|
+
result.appendIfPresent(`,tls-name=${proxy.sni}`, "sni");
|
|
7034
|
+
result.appendIfPresent(
|
|
7035
|
+
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
7036
|
+
"tls-fingerprint"
|
|
7037
|
+
);
|
|
7038
|
+
result.appendIfPresent(
|
|
7039
|
+
`,tls-pubkey-sha256=${proxy["tls-pubkey-sha256"]}`,
|
|
7040
|
+
"tls-pubkey-sha256"
|
|
7041
|
+
);
|
|
7042
|
+
}
|
|
7023
7043
|
result.appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
7024
7044
|
if (proxy["block-quic"] === "on") {
|
|
7025
7045
|
result.append(",block-quic=true");
|
|
@@ -7034,6 +7054,7 @@ function trojan2(proxy) {
|
|
|
7034
7054
|
return result.toString();
|
|
7035
7055
|
}
|
|
7036
7056
|
function anytls2(proxy) {
|
|
7057
|
+
const isReality = !!proxy["reality-opts"];
|
|
7037
7058
|
const result = new Result(proxy);
|
|
7038
7059
|
result.append(
|
|
7039
7060
|
`${proxy.name}=anytls,${proxy.server},${proxy.port},"${proxy.password}"`
|
|
@@ -7054,15 +7075,19 @@ function anytls2(proxy) {
|
|
|
7054
7075
|
);
|
|
7055
7076
|
appendTlsProfile(result, proxy);
|
|
7056
7077
|
appendAlpn(result, proxy);
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7078
|
+
if (isReality) {
|
|
7079
|
+
appendReality(result, proxy);
|
|
7080
|
+
} else {
|
|
7081
|
+
result.appendIfPresent(`,tls-name=${proxy.sni}`, "sni");
|
|
7082
|
+
result.appendIfPresent(
|
|
7083
|
+
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
7084
|
+
"tls-fingerprint"
|
|
7085
|
+
);
|
|
7086
|
+
result.appendIfPresent(
|
|
7087
|
+
`,tls-pubkey-sha256=${proxy["tls-pubkey-sha256"]}`,
|
|
7088
|
+
"tls-pubkey-sha256"
|
|
7089
|
+
);
|
|
7090
|
+
}
|
|
7066
7091
|
result.appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
7067
7092
|
if (proxy["block-quic"] === "on") {
|
|
7068
7093
|
result.append(",block-quic=true");
|
|
@@ -7125,15 +7150,7 @@ function vmess2(proxy) {
|
|
|
7125
7150
|
appendAlpn(result, proxy);
|
|
7126
7151
|
}
|
|
7127
7152
|
if (isReality) {
|
|
7128
|
-
result
|
|
7129
|
-
result.appendIfPresent(
|
|
7130
|
-
`,public-key="${proxy["reality-opts"]["public-key"]}"`,
|
|
7131
|
-
"reality-opts.public-key"
|
|
7132
|
-
);
|
|
7133
|
-
result.appendIfPresent(
|
|
7134
|
-
`,short-id=${proxy["reality-opts"]["short-id"]}`,
|
|
7135
|
-
"reality-opts.short-id"
|
|
7136
|
-
);
|
|
7153
|
+
appendReality(result, proxy);
|
|
7137
7154
|
} else {
|
|
7138
7155
|
result.appendIfPresent(`,tls-name=${proxy.sni}`, "sni");
|
|
7139
7156
|
result.appendIfPresent(
|
|
@@ -7224,15 +7241,7 @@ function vless(proxy) {
|
|
|
7224
7241
|
result.appendIfPresent(`,flow=${proxy.flow}`, "flow");
|
|
7225
7242
|
}
|
|
7226
7243
|
if (isReality) {
|
|
7227
|
-
result
|
|
7228
|
-
result.appendIfPresent(
|
|
7229
|
-
`,public-key="${proxy["reality-opts"]["public-key"]}"`,
|
|
7230
|
-
"reality-opts.public-key"
|
|
7231
|
-
);
|
|
7232
|
-
result.appendIfPresent(
|
|
7233
|
-
`,short-id=${proxy["reality-opts"]["short-id"]}`,
|
|
7234
|
-
"reality-opts.short-id"
|
|
7235
|
-
);
|
|
7244
|
+
appendReality(result, proxy);
|
|
7236
7245
|
} else {
|
|
7237
7246
|
result.appendIfPresent(`,tls-name=${proxy.sni}`, "sni");
|
|
7238
7247
|
result.appendIfPresent(
|