sub-store-convert 2.21.15 → 2.21.25

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.
Files changed (2) hide show
  1. package/index.js +107 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -78,7 +78,7 @@ var grammars = String.raw`
78
78
  }
79
79
  }
80
80
 
81
- start = (anytls/shadowsocks/vmess/trojan/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/direct) {
81
+ start = (anytls/shadowsocks/vmess/trojan/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/trust_tunnel/direct) {
82
82
  return proxy;
83
83
  }
84
84
 
@@ -163,6 +163,11 @@ anytls = tag equals "anytls" address (passwordk/reuse/ip_version/underlying_prox
163
163
  proxy.type = "anytls";
164
164
  proxy.tls = true;
165
165
  }
166
+ trust_tunnel = tag equals "trust-tunnel" address (usernamek/passwordk/reuse/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls_fingerprint/tls_verification/sni/fast_open/tfo/block_quic/others)* {
167
+ proxy.type = "trust-tunnel";
168
+ proxy.tls = true;
169
+ }
170
+
166
171
  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)* {
167
172
  proxy.type = "direct";
168
173
  }
@@ -2019,9 +2024,11 @@ function Clash_All() {
2019
2024
  proxy = yaml_default.parse(line);
2020
2025
  }
2021
2026
  if (![
2027
+ "trust-tunnel",
2022
2028
  "naive",
2023
2029
  "anytls",
2024
2030
  "mieru",
2031
+ "masque",
2025
2032
  "sudoku",
2026
2033
  "juicity",
2027
2034
  "ss",
@@ -2305,6 +2312,14 @@ function Surge_Anytls() {
2305
2312
  const parse = (line) => getParser().parse(line);
2306
2313
  return { name, test, parse };
2307
2314
  }
2315
+ function Surge_TrustTunnel() {
2316
+ const name = "Surge TrustTunnel Parser";
2317
+ const test = (line) => {
2318
+ return /^.*=\s*trust-tunnel/.test(line.split(",")[0]);
2319
+ };
2320
+ const parse = (line) => getParser().parse(line);
2321
+ return { name, test, parse };
2322
+ }
2308
2323
  function Surge_SSH() {
2309
2324
  const name = "Surge SSH Parser";
2310
2325
  const test = (line) => {
@@ -2474,6 +2489,7 @@ var parsers_default = [
2474
2489
  Clash_All(),
2475
2490
  Surge_Direct(),
2476
2491
  Surge_Anytls(),
2492
+ Surge_TrustTunnel(),
2477
2493
  Surge_SSH(),
2478
2494
  Surge_SS(),
2479
2495
  Surge_VMess(),
@@ -2585,6 +2601,9 @@ function Surge_Producer() {
2585
2601
  }
2586
2602
  return anytls(proxy);
2587
2603
  }
2604
+ if (opts["include-unsupported-proxy"] && proxy.type === "trust-tunnel") {
2605
+ return trust_tunnel(proxy);
2606
+ }
2588
2607
  throw new Error(
2589
2608
  `Platform ${targetPlatform} does not support proxy type: ${proxy.type}`
2590
2609
  );
@@ -2816,6 +2835,52 @@ function anytls(proxy) {
2816
2835
  result.appendIfPresent(`,reuse=${proxy["reuse"]}`, "reuse");
2817
2836
  return result.toString();
2818
2837
  }
2838
+ function trust_tunnel(proxy) {
2839
+ const result = new Result(proxy);
2840
+ result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
2841
+ result.appendIfPresent(`,password="${proxy.password}"`, "password");
2842
+ const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
2843
+ result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
2844
+ result.appendIfPresent(
2845
+ `,no-error-alert=${proxy["no-error-alert"]}`,
2846
+ "no-error-alert"
2847
+ );
2848
+ result.appendIfPresent(
2849
+ `,server-cert-fingerprint-sha256=${proxy["tls-fingerprint"]}`,
2850
+ "tls-fingerprint"
2851
+ );
2852
+ result.appendIfPresent(`,sni=${proxy.sni}`, "sni");
2853
+ result.appendIfPresent(
2854
+ `,skip-cert-verify=${proxy["skip-cert-verify"]}`,
2855
+ "skip-cert-verify"
2856
+ );
2857
+ result.appendIfPresent(`,tfo=${proxy.tfo}`, "tfo");
2858
+ result.appendIfPresent(`,udp-relay=${proxy.udp}`, "udp");
2859
+ result.appendIfPresent(`,test-url=${proxy["test-url"]}`, "test-url");
2860
+ result.appendIfPresent(
2861
+ `,test-timeout=${proxy["test-timeout"]}`,
2862
+ "test-timeout"
2863
+ );
2864
+ result.appendIfPresent(`,test-udp=${proxy["test-udp"]}`, "test-udp");
2865
+ result.appendIfPresent(`,hybrid=${proxy["hybrid"]}`, "hybrid");
2866
+ result.appendIfPresent(`,tos=${proxy["tos"]}`, "tos");
2867
+ result.appendIfPresent(
2868
+ `,allow-other-interface=${proxy["allow-other-interface"]}`,
2869
+ "allow-other-interface"
2870
+ );
2871
+ result.appendIfPresent(
2872
+ `,interface=${proxy["interface-name"]}`,
2873
+ "interface-name"
2874
+ );
2875
+ result.appendIfPresent(`,interface=${proxy["interface"]}`, "interface");
2876
+ result.appendIfPresent(`,block-quic=${proxy["block-quic"]}`, "block-quic");
2877
+ result.appendIfPresent(
2878
+ `,underlying-proxy=${proxy["underlying-proxy"]}`,
2879
+ "underlying-proxy"
2880
+ );
2881
+ result.appendIfPresent(`,reuse=${proxy["reuse"]}`, "reuse");
2882
+ return result.toString();
2883
+ }
2819
2884
  function vmess(proxy, includeUnsupportedProxy) {
2820
2885
  const result = new Result(proxy);
2821
2886
  result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
@@ -3503,7 +3568,7 @@ function ClashMeta_Producer() {
3503
3568
  if (opts["include-unsupported-proxy"]) return true;
3504
3569
  if (proxy.type === "snell" && proxy.version >= 4) {
3505
3570
  return false;
3506
- } else if (["juicity", "naive"].includes(proxy.type)) {
3571
+ } else if (["trust-tunnel", "juicity", "naive"].includes(proxy.type)) {
3507
3572
  return false;
3508
3573
  } else if (["ss"].includes(proxy.type) && ![
3509
3574
  "aes-128-ctr",
@@ -3667,6 +3732,7 @@ function ClashMeta_Producer() {
3667
3732
  "hysteria2",
3668
3733
  "juicity",
3669
3734
  "anytls",
3735
+ "trust-tunnel",
3670
3736
  "naive"
3671
3737
  ].includes(proxy.type)) {
3672
3738
  delete proxy.tls;
@@ -3961,6 +4027,7 @@ function Clash_Producer() {
3961
4027
  "hysteria2",
3962
4028
  "juicity",
3963
4029
  "anytls",
4030
+ "trust-tunnel",
3964
4031
  "naive"
3965
4032
  ].includes(proxy.type)) {
3966
4033
  delete proxy.tls;
@@ -4035,11 +4102,6 @@ function Stash_Producer() {
4035
4102
  "2022-blake3-aes-256-gcm"
4036
4103
  ].includes(proxy.cipher) || proxy.type === "snell" && proxy.version >= 4 || proxy.type === "vless" && proxy["reality-opts"] && !["xtls-rprx-vision"].includes(proxy.flow)) {
4037
4104
  return false;
4038
- } else if (proxy["underlying-proxy"] || proxy["dialer-proxy"]) {
4039
- app_default.error(
4040
- `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`
4041
- );
4042
- return false;
4043
4105
  } else if (["anytls"].includes(proxy.type) && !opts["include-unsupported-proxy"]) {
4044
4106
  return false;
4045
4107
  } else if (["anytls"].includes(proxy.type) && proxy.network && (!["tcp"].includes(proxy.network) || ["tcp"].includes(proxy.network) && proxy["reality-opts"])) {
@@ -4196,6 +4258,7 @@ function Stash_Producer() {
4196
4258
  "hysteria2",
4197
4259
  "juicity",
4198
4260
  "anytls",
4261
+ "trust-tunnel",
4199
4262
  "naive"
4200
4263
  ].includes(proxy.type)) {
4201
4264
  delete proxy.tls;
@@ -4946,7 +5009,8 @@ function URI_Producer() {
4946
5009
  "hysteria",
4947
5010
  "hysteria2",
4948
5011
  "juicity",
4949
- "anytls"
5012
+ "anytls",
5013
+ "trust-tunnel"
4950
5014
  ].includes(proxy.type)) {
4951
5015
  delete proxy.tls;
4952
5016
  }
@@ -5992,7 +6056,13 @@ function Shadowrocket_Producer() {
5992
6056
  if (opts["include-unsupported-proxy"]) return true;
5993
6057
  if (proxy.type === "snell" && proxy.version >= 4) {
5994
6058
  return false;
5995
- } else if (["mieru", "sudoku", "naive"].includes(proxy.type)) {
6059
+ } else if ([
6060
+ "trust-tunnel",
6061
+ "mieru",
6062
+ "sudoku",
6063
+ "naive",
6064
+ "masque"
6065
+ ].includes(proxy.type)) {
5996
6066
  return false;
5997
6067
  } else if (proxy.encryption && proxy.encryption !== "none" && ["vless"].includes(proxy.type)) {
5998
6068
  return false;
@@ -6125,6 +6195,7 @@ function Shadowrocket_Producer() {
6125
6195
  "hysteria2",
6126
6196
  "juicity",
6127
6197
  "anytls",
6198
+ "trust-tunnel",
6128
6199
  "naive"
6129
6200
  ].includes(proxy.type)) {
6130
6201
  delete proxy.tls;
@@ -6186,6 +6257,8 @@ function Surfboard_Producer() {
6186
6257
  return http4(proxy);
6187
6258
  case "socks5":
6188
6259
  return socks54(proxy);
6260
+ case "anytls":
6261
+ return anytls2(proxy);
6189
6262
  case "wireguard-surge":
6190
6263
  return wireguard3(proxy);
6191
6264
  }
@@ -6195,6 +6268,20 @@ function Surfboard_Producer() {
6195
6268
  };
6196
6269
  return { produce: produce2 };
6197
6270
  }
6271
+ function anytls2(proxy) {
6272
+ const result = new Result(proxy);
6273
+ result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
6274
+ result.appendIfPresent(`,password="${proxy.password}"`, "password");
6275
+ result.appendIfPresent(`,sni=${proxy.sni}`, "sni");
6276
+ result.appendIfPresent(
6277
+ `,skip-cert-verify=${proxy["skip-cert-verify"]}`,
6278
+ "skip-cert-verify"
6279
+ );
6280
+ result.appendIfPresent(`,tfo=${proxy.tfo}`, "tfo");
6281
+ result.appendIfPresent(`,udp-relay=${proxy.udp}`, "udp");
6282
+ result.appendIfPresent(`,reuse=${proxy["reuse"]}`, "reuse");
6283
+ return result.toString();
6284
+ }
6198
6285
  function shadowsocks4(proxy) {
6199
6286
  const result = new Result(proxy);
6200
6287
  result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
@@ -6218,12 +6305,14 @@ function shadowsocks4(proxy) {
6218
6305
  "camellia-256-cfb",
6219
6306
  "salsa20",
6220
6307
  "chacha20",
6221
- "chacha20-ietf"
6308
+ "chacha20-ietf",
6309
+ "2022-blake3-aes-128-gcm",
6310
+ "2022-blake3-aes-256-gcm"
6222
6311
  ].includes(proxy.cipher)) {
6223
6312
  throw new Error(`cipher ${proxy.cipher} is not supported`);
6224
6313
  }
6225
6314
  result.append(`,encrypt-method=${proxy.cipher}`);
6226
- result.appendIfPresent(`,password=${proxy.password}`, "password");
6315
+ result.appendIfPresent(`,password="${proxy.password}"`, "password");
6227
6316
  if (isPresent2(proxy, "plugin")) {
6228
6317
  if (proxy.plugin === "obfs") {
6229
6318
  result.append(`,obfs=${proxy["plugin-opts"].mode}`);
@@ -6599,6 +6688,9 @@ var tlsParser = (proxy, parsedProxy) => {
6599
6688
  if (proxy._ech && isPlainObject(proxy._ech)) {
6600
6689
  parsedProxy.tls.ech = proxy._ech;
6601
6690
  }
6691
+ if (proxy._curve_preferences && Array.isArray(proxy._curve_preferences)) {
6692
+ parsedProxy.tls.curve_preferences = proxy._curve_preferences;
6693
+ }
6602
6694
  if (proxy["_fragment"]) parsedProxy.tls.fragment = !!proxy["_fragment"];
6603
6695
  if (proxy["_fragment_fallback_delay"])
6604
6696
  parsedProxy.tls.fragment_fallback_delay = proxy["_fragment_fallback_delay"];
@@ -7301,7 +7393,10 @@ function Egern_Producer() {
7301
7393
  "vless",
7302
7394
  "vmess",
7303
7395
  "tuic",
7304
- ...opts["include-unsupported-proxy"] ? ["wireguard"] : []
7396
+ "wireguard"
7397
+ // ...(opts['include-unsupported-proxy']
7398
+ // ? ['wireguard']
7399
+ // : []),
7305
7400
  ].includes(proxy.type) || proxy.type === "ss" && (proxy.plugin === "obfs" && !["http", "tls"].includes(
7306
7401
  proxy["plugin-opts"]?.mode
7307
7402
  ) || ![
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sub-store-convert",
3
- "version": "2.21.15",
3
+ "version": "2.21.25",
4
4
  "description": "Advanced Subscription Converter for QX, Loon, Surge, Stash and ShadowRocket.",
5
5
  "type": "module",
6
6
  "module": "./index.js",