sub-store-convert 2.36.10 → 2.36.27
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 +184 -47
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1150,8 +1150,13 @@ fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
|
|
|
1150
1150
|
|
|
1151
1151
|
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
|
|
1152
1152
|
tls_host = comma sni:("tls-host") equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
1153
|
-
tls_verification = comma "tls-verification" equals
|
|
1154
|
-
|
|
1153
|
+
tls_verification = comma "tls-verification" equals raw:$[^,]+ {
|
|
1154
|
+
const value = raw.trim();
|
|
1155
|
+
if (value === "true" || value === "false") {
|
|
1156
|
+
proxy["skip-cert-verify"] = value !== "true";
|
|
1157
|
+
} else {
|
|
1158
|
+
proxy["name-cert-verify"] = value;
|
|
1159
|
+
}
|
|
1155
1160
|
}
|
|
1156
1161
|
tls_fingerprint = comma "tls-cert-sha256" equals tls_fingerprint:$[^,]+ { proxy["tls-fingerprint"] = tls_fingerprint.trim(); }
|
|
1157
1162
|
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals param:$[^=,]+ { proxy["tls-pubkey-sha256"] = param; }
|
|
@@ -4016,6 +4021,7 @@ function Clash_All() {
|
|
|
4016
4021
|
proxy = yaml_default.parse(line);
|
|
4017
4022
|
}
|
|
4018
4023
|
if (![
|
|
4024
|
+
"zerotier",
|
|
4019
4025
|
"shadowquic",
|
|
4020
4026
|
"gost-relay",
|
|
4021
4027
|
"openvpn",
|
|
@@ -4770,6 +4776,38 @@ function supportsShadowsocksV2rayPluginMode(proxy, supportedModes) {
|
|
|
4770
4776
|
const normalizedMode = typeof proxy?.["plugin-opts"]?.mode === "string" ? proxy["plugin-opts"].mode.trim().toLowerCase() : proxy?.["plugin-opts"]?.mode;
|
|
4771
4777
|
return supportedModes.includes(normalizedMode);
|
|
4772
4778
|
}
|
|
4779
|
+
function restoreShadowTLSOpts(target, serverNameKey) {
|
|
4780
|
+
if (target?.plugin !== "shadow-tls" || !target["plugin-opts"]) {
|
|
4781
|
+
return void 0;
|
|
4782
|
+
}
|
|
4783
|
+
const opts = target["plugin-opts"];
|
|
4784
|
+
const enabled = Boolean(opts.password) || opts.version != null && Number(opts.version) !== 0;
|
|
4785
|
+
target["shadow-tls-opts"] = {
|
|
4786
|
+
password: opts.password,
|
|
4787
|
+
version: opts.version
|
|
4788
|
+
};
|
|
4789
|
+
if (opts.host != null)
|
|
4790
|
+
target[serverNameKey] = opts.host;
|
|
4791
|
+
if (opts.alpn != null)
|
|
4792
|
+
target.alpn = opts.alpn;
|
|
4793
|
+
delete target.plugin;
|
|
4794
|
+
delete target["plugin-opts"];
|
|
4795
|
+
return enabled;
|
|
4796
|
+
}
|
|
4797
|
+
function restoreShadowTLSProxyOpts(proxy) {
|
|
4798
|
+
if (["vmess", "vless", "trojan", "anytls"].includes(proxy.type)) {
|
|
4799
|
+
const restored = restoreShadowTLSOpts(proxy, "sni");
|
|
4800
|
+
if (restored && ["vmess", "vless"].includes(proxy.type)) {
|
|
4801
|
+
proxy.tls = true;
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
if (proxy.type === "vless" && proxy.network === "xhttp") {
|
|
4805
|
+
const downloadSettings = proxy["xhttp-opts"]?.["download-settings"];
|
|
4806
|
+
if (restoreShadowTLSOpts(downloadSettings, "servername")) {
|
|
4807
|
+
downloadSettings.tls = true;
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
}
|
|
4773
4811
|
function parseWireGuardCIDR(cidr, max) {
|
|
4774
4812
|
if (cidr == null)
|
|
4775
4813
|
return void 0;
|
|
@@ -5882,11 +5920,27 @@ function ClashMeta_Producer() {
|
|
|
5882
5920
|
return false;
|
|
5883
5921
|
} else if (proxy.type === "snell" && !isSupportedMihomoVersion(proxy.version, [1, 2, 3, 4, 5])) {
|
|
5884
5922
|
return false;
|
|
5885
|
-
} else if (hasMihomoShadowTls(proxy) && (![
|
|
5923
|
+
} else if (hasMihomoShadowTls(proxy) && (![
|
|
5924
|
+
"ss",
|
|
5925
|
+
"snell",
|
|
5926
|
+
"vmess",
|
|
5927
|
+
"vless",
|
|
5928
|
+
"trojan",
|
|
5929
|
+
"anytls"
|
|
5930
|
+
].includes(proxy.type) || !isSupportedMihomoVersion(
|
|
5886
5931
|
getMihomoShadowTlsVersion(proxy),
|
|
5887
|
-
[1, 2, 3]
|
|
5932
|
+
["ss", "snell"].includes(proxy.type) ? [1, 2, 3] : [0, 1, 2, 3]
|
|
5888
5933
|
))) {
|
|
5889
5934
|
return false;
|
|
5935
|
+
} else if (proxy.type === "vless" && proxy.network === "xhttp" && hasMihomoShadowTls(
|
|
5936
|
+
proxy["xhttp-opts"]?.["download-settings"]
|
|
5937
|
+
) && !isSupportedMihomoVersion(
|
|
5938
|
+
getMihomoShadowTlsVersion(
|
|
5939
|
+
proxy["xhttp-opts"]["download-settings"]
|
|
5940
|
+
),
|
|
5941
|
+
[0, 1, 2, 3]
|
|
5942
|
+
)) {
|
|
5943
|
+
return false;
|
|
5890
5944
|
} else if (hasMihomoSnellShadowTlsObfsConflict(proxy)) {
|
|
5891
5945
|
app_default.error(
|
|
5892
5946
|
`Platform Mihomo does not support Snell shadow-tls with obfs for proxy ${proxy.name}. Proxy has been filtered.`
|
|
@@ -5939,6 +5993,7 @@ function ClashMeta_Producer() {
|
|
|
5939
5993
|
return true;
|
|
5940
5994
|
}).map((proxy) => {
|
|
5941
5995
|
warnMihomoUnsupportedEchDnsFields(proxy, type2);
|
|
5996
|
+
restoreShadowTLSProxyOpts(proxy);
|
|
5942
5997
|
if (proxy["reality-opts"] && !proxy["client-fingerprint"]) {
|
|
5943
5998
|
proxy["client-fingerprint"] = "chrome";
|
|
5944
5999
|
}
|
|
@@ -8710,6 +8765,13 @@ function getQxHttpObfs(proxy) {
|
|
|
8710
8765
|
proxy._qx_obfs_http
|
|
8711
8766
|
) ? proxy._qx_obfs_http : "http";
|
|
8712
8767
|
}
|
|
8768
|
+
function appendTlsVerification(result, proxy) {
|
|
8769
|
+
const attr = isPresent2(proxy, "name-cert-verify") ? "name-cert-verify" : "skip-cert-verify";
|
|
8770
|
+
result.appendIfPresent(
|
|
8771
|
+
`,tls-verification=${proxy["name-cert-verify"] ?? !proxy["skip-cert-verify"]}`,
|
|
8772
|
+
attr
|
|
8773
|
+
);
|
|
8774
|
+
}
|
|
8713
8775
|
function shadowsocks3(proxy) {
|
|
8714
8776
|
const result = new Result(proxy);
|
|
8715
8777
|
const append = result.append.bind(result);
|
|
@@ -8802,10 +8864,7 @@ function shadowsocks3(proxy) {
|
|
|
8802
8864
|
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
8803
8865
|
"tls-fingerprint"
|
|
8804
8866
|
);
|
|
8805
|
-
|
|
8806
|
-
`,tls-verification=${!proxy["skip-cert-verify"]}`,
|
|
8807
|
-
"skip-cert-verify"
|
|
8808
|
-
);
|
|
8867
|
+
appendTlsVerification(result, proxy);
|
|
8809
8868
|
if (!isSSOverTls) {
|
|
8810
8869
|
appendIfPresent(`,tls-host=${proxy.sni}`, "sni");
|
|
8811
8870
|
}
|
|
@@ -8896,10 +8955,7 @@ function trojan3(proxy) {
|
|
|
8896
8955
|
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
8897
8956
|
"tls-fingerprint"
|
|
8898
8957
|
);
|
|
8899
|
-
|
|
8900
|
-
`,tls-verification=${!proxy["skip-cert-verify"]}`,
|
|
8901
|
-
"skip-cert-verify"
|
|
8902
|
-
);
|
|
8958
|
+
appendTlsVerification(result, proxy);
|
|
8903
8959
|
appendIfPresent(`,tls-host=${proxy.sni}`, "sni");
|
|
8904
8960
|
}
|
|
8905
8961
|
appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
@@ -8968,10 +9024,7 @@ function vmess3(proxy) {
|
|
|
8968
9024
|
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
8969
9025
|
"tls-fingerprint"
|
|
8970
9026
|
);
|
|
8971
|
-
|
|
8972
|
-
`,tls-verification=${!proxy["skip-cert-verify"]}`,
|
|
8973
|
-
"skip-cert-verify"
|
|
8974
|
-
);
|
|
9027
|
+
appendTlsVerification(result, proxy);
|
|
8975
9028
|
appendIfPresent(`,tls-host=${proxy.sni}`, "sni");
|
|
8976
9029
|
}
|
|
8977
9030
|
if (isPresent2(proxy, "aead")) {
|
|
@@ -9047,10 +9100,7 @@ function vless3(proxy) {
|
|
|
9047
9100
|
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
9048
9101
|
"tls-fingerprint"
|
|
9049
9102
|
);
|
|
9050
|
-
|
|
9051
|
-
`,tls-verification=${!proxy["skip-cert-verify"]}`,
|
|
9052
|
-
"skip-cert-verify"
|
|
9053
|
-
);
|
|
9103
|
+
appendTlsVerification(result, proxy);
|
|
9054
9104
|
appendIfPresent(`,tls-host=${proxy.sni}`, "sni");
|
|
9055
9105
|
}
|
|
9056
9106
|
appendIfPresent(`,vless-flow=${proxy.flow}`, "flow");
|
|
@@ -9094,10 +9144,7 @@ function anytls3(proxy) {
|
|
|
9094
9144
|
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
9095
9145
|
"tls-fingerprint"
|
|
9096
9146
|
);
|
|
9097
|
-
|
|
9098
|
-
`,tls-verification=${!proxy["skip-cert-verify"]}`,
|
|
9099
|
-
"skip-cert-verify"
|
|
9100
|
-
);
|
|
9147
|
+
appendTlsVerification(result, proxy);
|
|
9101
9148
|
appendIfPresent(`,tls-host=${proxy.sni}`, "sni");
|
|
9102
9149
|
appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
9103
9150
|
appendIfPresent(`,udp-relay=${proxy.udp}`, "udp");
|
|
@@ -9137,10 +9184,7 @@ function http3(proxy) {
|
|
|
9137
9184
|
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
9138
9185
|
"tls-fingerprint"
|
|
9139
9186
|
);
|
|
9140
|
-
|
|
9141
|
-
`,tls-verification=${!proxy["skip-cert-verify"]}`,
|
|
9142
|
-
"skip-cert-verify"
|
|
9143
|
-
);
|
|
9187
|
+
appendTlsVerification(result, proxy);
|
|
9144
9188
|
appendIfPresent(`,tls-host=${proxy.sni}`, "sni");
|
|
9145
9189
|
}
|
|
9146
9190
|
appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
@@ -9181,10 +9225,7 @@ function socks53(proxy) {
|
|
|
9181
9225
|
`,tls-cert-sha256=${proxy["tls-fingerprint"]}`,
|
|
9182
9226
|
"tls-fingerprint"
|
|
9183
9227
|
);
|
|
9184
|
-
|
|
9185
|
-
`,tls-verification=${!proxy["skip-cert-verify"]}`,
|
|
9186
|
-
"skip-cert-verify"
|
|
9187
|
-
);
|
|
9228
|
+
appendTlsVerification(result, proxy);
|
|
9188
9229
|
appendIfPresent(`,tls-host=${proxy.sni}`, "sni");
|
|
9189
9230
|
}
|
|
9190
9231
|
appendIfPresent(`,fast-open=${proxy.tfo}`, "tfo");
|
|
@@ -9215,7 +9256,7 @@ function Shadowrocket_Producer() {
|
|
|
9215
9256
|
"grpc"
|
|
9216
9257
|
])) {
|
|
9217
9258
|
return false;
|
|
9218
|
-
} else if (proxy.type === "snell" && ![1, 2, 3, 4, 5].includes(proxy.version)) {
|
|
9259
|
+
} else if (proxy.type === "snell" && ![1, 2, 3, 4, 5, 6].includes(proxy.version)) {
|
|
9219
9260
|
return false;
|
|
9220
9261
|
} else if (hasShadowrocketSnellShadowTlsObfsConflict(proxy)) {
|
|
9221
9262
|
app_default.error(
|
|
@@ -9228,7 +9269,8 @@ function Shadowrocket_Producer() {
|
|
|
9228
9269
|
"naive",
|
|
9229
9270
|
"openvpn",
|
|
9230
9271
|
"gost-relay",
|
|
9231
|
-
"shadowquic"
|
|
9272
|
+
"shadowquic",
|
|
9273
|
+
"zerotier"
|
|
9232
9274
|
].includes(proxy.type)) {
|
|
9233
9275
|
return false;
|
|
9234
9276
|
} else if (["xhttp"].includes(proxy.network)) {
|
|
@@ -9239,6 +9281,7 @@ function Shadowrocket_Producer() {
|
|
|
9239
9281
|
}
|
|
9240
9282
|
return true;
|
|
9241
9283
|
}).map((proxy) => {
|
|
9284
|
+
restoreShadowTLSProxyOpts(proxy);
|
|
9242
9285
|
if (proxy.type === "vmess") {
|
|
9243
9286
|
if (isPresent2(proxy, "aead")) {
|
|
9244
9287
|
if (proxy.aead) {
|
|
@@ -9449,6 +9492,8 @@ function Surfboard_Producer() {
|
|
|
9449
9492
|
return http4(proxy);
|
|
9450
9493
|
case "snell":
|
|
9451
9494
|
return snell2(proxy);
|
|
9495
|
+
case "tuic":
|
|
9496
|
+
return tuic2(proxy);
|
|
9452
9497
|
case "socks5":
|
|
9453
9498
|
return socks54(proxy);
|
|
9454
9499
|
case "hysteria2":
|
|
@@ -9470,6 +9515,33 @@ function Surfboard_Producer() {
|
|
|
9470
9515
|
};
|
|
9471
9516
|
return { produce: produce2 };
|
|
9472
9517
|
}
|
|
9518
|
+
function tuic2(proxy) {
|
|
9519
|
+
if (proxy.token?.length) {
|
|
9520
|
+
throw new Error(
|
|
9521
|
+
`Platform ${targetPlatform5} does not support proxy type ${proxy.type} v4`
|
|
9522
|
+
);
|
|
9523
|
+
}
|
|
9524
|
+
const result = new Result(proxy);
|
|
9525
|
+
result.append(`${proxy.name}=tuic-v5,${proxy.server},${proxy.port}`);
|
|
9526
|
+
result.appendIfPresent(`,uuid=${proxy.uuid}`, "uuid");
|
|
9527
|
+
result.appendIfPresent(`,password="${proxy.password}"`, "password");
|
|
9528
|
+
if (hasNonBlankValue2(proxy.alpn)) {
|
|
9529
|
+
result.append(
|
|
9530
|
+
`,alpn="${Array.isArray(proxy.alpn) ? proxy.alpn.join(",") : proxy.alpn}"`
|
|
9531
|
+
);
|
|
9532
|
+
}
|
|
9533
|
+
if (hasNonBlankValue2(proxy.ports)) {
|
|
9534
|
+
result.append(
|
|
9535
|
+
`,port-hopping="${String(proxy.ports).replace(/,/g, ";")}"`
|
|
9536
|
+
);
|
|
9537
|
+
}
|
|
9538
|
+
if (hasNonBlankValue2(proxy["hop-interval"])) {
|
|
9539
|
+
result.append(`,port-hopping-interval=${proxy["hop-interval"]}`);
|
|
9540
|
+
}
|
|
9541
|
+
appendTlsProxyParams2(result, proxy);
|
|
9542
|
+
result.appendIfPresent(`,udp-relay=${proxy.udp}`, "udp");
|
|
9543
|
+
return result.toString();
|
|
9544
|
+
}
|
|
9473
9545
|
function hysteria23(proxy) {
|
|
9474
9546
|
if (proxy.obfs && proxy.obfs !== "salamander" || proxy["obfs-password"] && proxy.obfs !== "salamander") {
|
|
9475
9547
|
throw new Error(`Surfboard Hysteria2 only supports salamander obfs`);
|
|
@@ -10251,6 +10323,8 @@ var shadowTLSOutboundParser = (proxy = {}, pluginOpts) => {
|
|
|
10251
10323
|
server_name: pluginOpts.host
|
|
10252
10324
|
}
|
|
10253
10325
|
};
|
|
10326
|
+
if (proxy["skip-cert-verify"])
|
|
10327
|
+
stPart.tls.insecure = true;
|
|
10254
10328
|
if (fingerprint) {
|
|
10255
10329
|
stPart.tls.utls = {
|
|
10256
10330
|
enabled: true,
|
|
@@ -10422,6 +10496,8 @@ var snellParser = (proxy = {}, includeUnsupportedProxy = false) => {
|
|
|
10422
10496
|
if (outputVersion === 6) {
|
|
10423
10497
|
if (proxy.mode)
|
|
10424
10498
|
parsedProxy.mode = proxy.mode;
|
|
10499
|
+
if (includeUnsupportedProxy && proxy["quic-proxy-mode"])
|
|
10500
|
+
parsedProxy.quic_proxy_mode = !!proxy["quic-proxy-mode"];
|
|
10425
10501
|
} else {
|
|
10426
10502
|
if (proxy["obfs-opts"]?.mode && proxy["obfs-opts"].mode !== "shadow-tls")
|
|
10427
10503
|
parsedProxy.obfs_mode = proxy["obfs-opts"].mode;
|
|
@@ -10778,7 +10854,7 @@ var tuic5Parser = (proxy = {}) => {
|
|
|
10778
10854
|
domainResolverParser(proxy, parsedProxy);
|
|
10779
10855
|
return parsedProxy;
|
|
10780
10856
|
};
|
|
10781
|
-
var anytlsParser = (proxy = {}) => {
|
|
10857
|
+
var anytlsParser = (proxy = {}, includeUnsupportedProxy = false) => {
|
|
10782
10858
|
const parsedProxy = {
|
|
10783
10859
|
tag: proxy.name,
|
|
10784
10860
|
type: "anytls",
|
|
@@ -10787,6 +10863,8 @@ var anytlsParser = (proxy = {}) => {
|
|
|
10787
10863
|
password: proxy.password,
|
|
10788
10864
|
tls: { enabled: true, server_name: proxy.server, insecure: false }
|
|
10789
10865
|
};
|
|
10866
|
+
if (includeUnsupportedProxy && proxy["client-name"])
|
|
10867
|
+
parsedProxy.client_name = `${proxy["client-name"]}`;
|
|
10790
10868
|
if (/^\d+$/.test(proxy["idle-session-check-interval"]))
|
|
10791
10869
|
parsedProxy.idle_session_check_interval = `${proxy["idle-session-check-interval"]}s`;
|
|
10792
10870
|
if (/^\d+$/.test(proxy["idle-session-timeout"]))
|
|
@@ -10942,9 +11020,9 @@ function singbox_Producer() {
|
|
|
10942
11020
|
const type = "ALL";
|
|
10943
11021
|
const produce2 = (proxies, type2, opts = {}) => {
|
|
10944
11022
|
const list = [];
|
|
10945
|
-
const
|
|
11023
|
+
const originalShadowTLS = new Map(
|
|
10946
11024
|
proxies.filter(
|
|
10947
|
-
(proxy) => proxy?.
|
|
11025
|
+
(proxy) => proxy?.plugin === "shadow-tls" && proxy?.["plugin-opts"]
|
|
10948
11026
|
).map((proxy) => [
|
|
10949
11027
|
proxy,
|
|
10950
11028
|
{
|
|
@@ -10955,17 +11033,57 @@ function singbox_Producer() {
|
|
|
10955
11033
|
])
|
|
10956
11034
|
);
|
|
10957
11035
|
ClashMeta_Producer().produce(proxies, "internal", { "include-unsupported-proxy": true }).map((proxy) => {
|
|
11036
|
+
const listStart = list.length;
|
|
10958
11037
|
try {
|
|
10959
|
-
const
|
|
10960
|
-
if (
|
|
10961
|
-
proxy.plugin =
|
|
10962
|
-
proxy["plugin-opts"] =
|
|
10963
|
-
if (
|
|
10964
|
-
proxy["obfs-opts"] =
|
|
11038
|
+
const shadowTLS = originalShadowTLS.get(proxy);
|
|
11039
|
+
if (shadowTLS) {
|
|
11040
|
+
proxy.plugin = shadowTLS.plugin;
|
|
11041
|
+
proxy["plugin-opts"] = shadowTLS["plugin-opts"];
|
|
11042
|
+
if (shadowTLS["obfs-opts"]) {
|
|
11043
|
+
proxy["obfs-opts"] = shadowTLS["obfs-opts"];
|
|
10965
11044
|
} else {
|
|
10966
11045
|
delete proxy["obfs-opts"];
|
|
10967
11046
|
}
|
|
10968
11047
|
}
|
|
11048
|
+
const shadowTLSPluginOpts = getShadowTLSPluginOpts(proxy);
|
|
11049
|
+
const shadowTLSEnabled = Boolean(
|
|
11050
|
+
shadowTLSPluginOpts && (shadowTLSPluginOpts.password || shadowTLSPluginOpts.version != null && Number(shadowTLSPluginOpts.version) !== 0)
|
|
11051
|
+
);
|
|
11052
|
+
let streamShadowTLSOutbound;
|
|
11053
|
+
if (shadowTLSEnabled && ["vmess", "vless", "trojan"].includes(proxy.type)) {
|
|
11054
|
+
if (proxy["reality-opts"]) {
|
|
11055
|
+
throw new Error(
|
|
11056
|
+
`Platform sing-box cannot chain ShadowTLS with Reality for proxy ${proxy.name}`
|
|
11057
|
+
);
|
|
11058
|
+
}
|
|
11059
|
+
if (["vmess", "vless"].includes(proxy.type) && proxy.network === "h2") {
|
|
11060
|
+
throw new Error(
|
|
11061
|
+
`Platform sing-box cannot chain ShadowTLS with network h2 for proxy ${proxy.name}`
|
|
11062
|
+
);
|
|
11063
|
+
}
|
|
11064
|
+
if (proxy.type === "vless" && proxy.flow === "xtls-rprx-vision") {
|
|
11065
|
+
throw new Error(
|
|
11066
|
+
`Platform sing-box cannot chain ShadowTLS with flow xtls-rprx-vision for proxy ${proxy.name}`
|
|
11067
|
+
);
|
|
11068
|
+
}
|
|
11069
|
+
const rawVersion = shadowTLSPluginOpts.version;
|
|
11070
|
+
const parsedVersion = typeof rawVersion === "string" && rawVersion.trim() === "" ? NaN : Number(rawVersion ?? 0);
|
|
11071
|
+
const version = parsedVersion === 0 ? 2 : parsedVersion;
|
|
11072
|
+
if (!Number.isInteger(version) || ![1, 2, 3].includes(version)) {
|
|
11073
|
+
throw new Error(
|
|
11074
|
+
`Platform sing-box does not support shadow-tls version ${rawVersion} for proxy ${proxy.name}`
|
|
11075
|
+
);
|
|
11076
|
+
}
|
|
11077
|
+
streamShadowTLSOutbound = shadowTLSOutboundParser(
|
|
11078
|
+
proxy,
|
|
11079
|
+
{ ...shadowTLSPluginOpts, version }
|
|
11080
|
+
);
|
|
11081
|
+
}
|
|
11082
|
+
if (proxy.type === "anytls" && shadowTLSEnabled) {
|
|
11083
|
+
throw new Error(
|
|
11084
|
+
"Platform sing-box cannot replace AnyTLS TLS with ShadowTLS"
|
|
11085
|
+
);
|
|
11086
|
+
}
|
|
10969
11087
|
if (["xhttp"].includes(proxy.network))
|
|
10970
11088
|
throw new Error(
|
|
10971
11089
|
`Platform sing-box does not support network: ${proxy.network}`
|
|
@@ -11011,12 +11129,12 @@ function singbox_Producer() {
|
|
|
11011
11129
|
opts["include-unsupported-proxy"]
|
|
11012
11130
|
)
|
|
11013
11131
|
);
|
|
11014
|
-
const
|
|
11015
|
-
if (
|
|
11132
|
+
const shadowTLSPluginOpts2 = getShadowTLSPluginOpts(proxy);
|
|
11133
|
+
if (shadowTLSPluginOpts2) {
|
|
11016
11134
|
list.push(
|
|
11017
11135
|
shadowTLSOutboundParser(
|
|
11018
11136
|
proxy,
|
|
11019
|
-
|
|
11137
|
+
shadowTLSPluginOpts2
|
|
11020
11138
|
)
|
|
11021
11139
|
);
|
|
11022
11140
|
}
|
|
@@ -11083,7 +11201,12 @@ function singbox_Producer() {
|
|
|
11083
11201
|
list.push(wireguardParser(proxy));
|
|
11084
11202
|
break;
|
|
11085
11203
|
case "anytls":
|
|
11086
|
-
list.push(
|
|
11204
|
+
list.push(
|
|
11205
|
+
anytlsParser(
|
|
11206
|
+
proxy,
|
|
11207
|
+
opts["include-unsupported-proxy"]
|
|
11208
|
+
)
|
|
11209
|
+
);
|
|
11087
11210
|
break;
|
|
11088
11211
|
case "tailscale":
|
|
11089
11212
|
list.push(tailscaleParser(proxy));
|
|
@@ -11093,7 +11216,21 @@ function singbox_Producer() {
|
|
|
11093
11216
|
`Platform sing-box does not support proxy type: ${proxy.type}`
|
|
11094
11217
|
);
|
|
11095
11218
|
}
|
|
11219
|
+
if (streamShadowTLSOutbound) {
|
|
11220
|
+
const outbound = list[listStart];
|
|
11221
|
+
outbound.detour = getShadowTLSTag(proxy);
|
|
11222
|
+
delete outbound.tls;
|
|
11223
|
+
list.push(streamShadowTLSOutbound);
|
|
11224
|
+
}
|
|
11225
|
+
if (opts["include-unsupported-proxy"] && proxy["name-cert-verify"]) {
|
|
11226
|
+
for (let i = listStart; i < list.length; i++) {
|
|
11227
|
+
const outbound = list[i];
|
|
11228
|
+
if (outbound.tls)
|
|
11229
|
+
outbound.tls.certificate_server_name = proxy["name-cert-verify"];
|
|
11230
|
+
}
|
|
11231
|
+
}
|
|
11096
11232
|
} catch (e) {
|
|
11233
|
+
list.length = listStart;
|
|
11097
11234
|
app_default.error(e.message ?? e);
|
|
11098
11235
|
}
|
|
11099
11236
|
});
|