sub-store-convert 2.14.420 → 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.
Files changed (3) hide show
  1. package/README.md +10 -1
  2. package/build/index.js +466 -56
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,3 +1,12 @@
1
1
  # sub-store-convert
2
2
 
3
- **sub-store-convert** is a tool that runs the node conversion logic independently from the [**Sub-Store**](https://github.com/sub-store-org/Sub-Store).
3
+ **sub-store-convert** is a tool that runs the node conversion logic independently from the [**Sub-Store**](https://github.com/sub-store-org/Sub-Store).
4
+
5
+ ## Usage
6
+ ### Example
7
+ - [Cloudflare Workers Example](./example/sub-workers/)
8
+
9
+
10
+ ## LICENSE
11
+
12
+ **sub-store-convert** is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
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 userInfoStr = Base64.decode(content.split("@")[0]);
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
- const userInfo = userInfoStr.match(/(^.*?):(.*$)/);
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) {
@@ -2056,13 +2112,18 @@ function isPresent2(obj, attr) {
2056
2112
  }
2057
2113
 
2058
2114
  // src/core/app/index.js
2059
- var app_default = new Proxy({}, {
2060
- apply: function(target, thisArg, argumentsList) {
2061
- console.log(`Function called with arguments: ${argumentsList.join(", ")}`);
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
+ };
2062
2123
  }
2063
2124
  });
2064
2125
 
2065
- // Sub-Store/backend/src/core/proxy-utils/producers/surge.js
2126
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/surge.js
2066
2127
  var targetPlatform = "Surge";
2067
2128
  var ipVersions = {
2068
2129
  dual: "dual",
@@ -2086,6 +2147,8 @@ function Surge_Producer() {
2086
2147
  return vmess(proxy, opts["include-unsupported-proxy"]);
2087
2148
  case "http":
2088
2149
  return http(proxy);
2150
+ case "direct":
2151
+ return direct(proxy);
2089
2152
  case "socks5":
2090
2153
  return socks5(proxy);
2091
2154
  case "snell":
@@ -2146,7 +2209,7 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
2146
2209
  throw new Error(`cipher ${proxy.cipher} is not supported`);
2147
2210
  }
2148
2211
  result.append(`,encrypt-method=${proxy.cipher}`);
2149
- result.appendIfPresent(`,password=${proxy.password}`, "password");
2212
+ result.appendIfPresent(`,password="${proxy.password}"`, "password");
2150
2213
  const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
2151
2214
  result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
2152
2215
  result.appendIfPresent(
@@ -2226,7 +2289,7 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
2226
2289
  function trojan(proxy) {
2227
2290
  const result = new Result(proxy);
2228
2291
  result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
2229
- result.appendIfPresent(`,password=${proxy.password}`, "password");
2292
+ result.appendIfPresent(`,password="${proxy.password}"`, "password");
2230
2293
  const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
2231
2294
  result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
2232
2295
  result.appendIfPresent(
@@ -2346,7 +2409,7 @@ function ssh(proxy) {
2346
2409
  const result = new Result(proxy);
2347
2410
  result.append(`${proxy.name}=ssh,${proxy.server},${proxy.port}`);
2348
2411
  result.appendIfPresent(`,${proxy.username}`, "username");
2349
- result.appendIfPresent(`,${proxy.password}`, "password");
2412
+ result.appendIfPresent(`,"${proxy.password}"`, "password");
2350
2413
  result.appendIfPresent(
2351
2414
  `,private-key=${proxy["keystore-private-key"]}`,
2352
2415
  "keystore-private-key"
@@ -2395,7 +2458,7 @@ function http(proxy) {
2395
2458
  const type = proxy.tls ? "https" : "http";
2396
2459
  result.append(`${proxy.name}=${type},${proxy.server},${proxy.port}`);
2397
2460
  result.appendIfPresent(`,${proxy.username}`, "username");
2398
- result.appendIfPresent(`,${proxy.password}`, "password");
2461
+ result.appendIfPresent(`,"${proxy.password}"`, "password");
2399
2462
  const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
2400
2463
  result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
2401
2464
  result.appendIfPresent(
@@ -2447,12 +2510,47 @@ function http(proxy) {
2447
2510
  );
2448
2511
  return result.toString();
2449
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
+ }
2450
2548
  function socks5(proxy) {
2451
2549
  const result = new Result(proxy);
2452
2550
  const type = proxy.tls ? "socks5-tls" : "socks5";
2453
2551
  result.append(`${proxy.name}=${type},${proxy.server},${proxy.port}`);
2454
2552
  result.appendIfPresent(`,${proxy.username}`, "username");
2455
- result.appendIfPresent(`,${proxy.password}`, "password");
2553
+ result.appendIfPresent(`,"${proxy.password}"`, "password");
2456
2554
  const ip_version = ipVersions[proxy["ip-version"]] || proxy["ip-version"];
2457
2555
  result.appendIfPresent(`,ip-version=${ip_version}`, "ip-version");
2458
2556
  result.appendIfPresent(
@@ -2574,7 +2672,7 @@ function tuic(proxy) {
2574
2672
  }
2575
2673
  result.append(`${proxy.name}=${type},${proxy.server},${proxy.port}`);
2576
2674
  result.appendIfPresent(`,uuid=${proxy.uuid}`, "uuid");
2577
- result.appendIfPresent(`,password=${proxy.password}`, "password");
2675
+ result.appendIfPresent(`,password="${proxy.password}"`, "password");
2578
2676
  result.appendIfPresent(`,token=${proxy.token}`, "token");
2579
2677
  result.appendIfPresent(
2580
2678
  `,alpn=${Array.isArray(proxy.alpn) ? proxy.alpn[0] : proxy.alpn}`,
@@ -2793,7 +2891,7 @@ function hysteria2(proxy) {
2793
2891
  }
2794
2892
  const result = new Result(proxy);
2795
2893
  result.append(`${proxy.name}=hysteria2,${proxy.server},${proxy.port}`);
2796
- result.appendIfPresent(`,password=${proxy.password}`, "password");
2894
+ result.appendIfPresent(`,password="${proxy.password}"`, "password");
2797
2895
  if (isPresent2(proxy, "ports")) {
2798
2896
  result.append(`,port-hopping="${proxy.ports.replace(/,/g, ";")}"`);
2799
2897
  }
@@ -2895,10 +2993,10 @@ function handleTransport(result, proxy, includeUnsupportedProxy) {
2895
2993
  }
2896
2994
  }
2897
2995
 
2898
- // Sub-Store/backend/src/core/proxy-utils/producers/surgemac.js
2996
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/surgemac.js
2899
2997
  import { Base64 as Base642 } from "js-base64";
2900
2998
 
2901
- // Sub-Store/backend/src/core/proxy-utils/producers/clashmeta.js
2999
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/clashmeta.js
2902
3000
  function ClashMeta_Producer() {
2903
3001
  const type = "ALL";
2904
3002
  const produce2 = (proxies, type2, opts = {}) => {
@@ -2906,6 +3004,8 @@ function ClashMeta_Producer() {
2906
3004
  if (opts["include-unsupported-proxy"]) return true;
2907
3005
  if (proxy.type === "snell" && String(proxy.version) === "4") {
2908
3006
  return false;
3007
+ } else if (["juicity"].includes(proxy.type)) {
3008
+ return false;
2909
3009
  }
2910
3010
  return true;
2911
3011
  }).map((proxy) => {
@@ -3029,6 +3129,7 @@ function ClashMeta_Producer() {
3029
3129
  }
3030
3130
  if (["grpc"].includes(proxy.network) && proxy[`${proxy.network}-opts`]) {
3031
3131
  delete proxy[`${proxy.network}-opts`]["_grpc-type"];
3132
+ delete proxy[`${proxy.network}-opts`]["_grpc-authority"];
3032
3133
  }
3033
3134
  return proxy;
3034
3135
  });
@@ -3037,7 +3138,7 @@ function ClashMeta_Producer() {
3037
3138
  return { type, produce: produce2 };
3038
3139
  }
3039
3140
 
3040
- // Sub-Store/backend/src/core/proxy-utils/producers/surgemac.js
3141
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/surgemac.js
3041
3142
  var targetPlatform2 = "SurgeMac";
3042
3143
  var surge_Producer = Surge_Producer();
3043
3144
  function SurgeMac_Producer() {
@@ -3156,7 +3257,7 @@ function isIP2(ip) {
3156
3257
  return isIPv4(ip) || isIPv6(ip);
3157
3258
  }
3158
3259
 
3159
- // Sub-Store/backend/src/core/proxy-utils/producers/clash.js
3260
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/clash.js
3160
3261
  function Clash_Producer() {
3161
3262
  const type = "ALL";
3162
3263
  const produce2 = (proxies, type2, opts = {}) => {
@@ -3281,6 +3382,7 @@ function Clash_Producer() {
3281
3382
  }
3282
3383
  if (["grpc"].includes(proxy.network) && proxy[`${proxy.network}-opts`]) {
3283
3384
  delete proxy[`${proxy.network}-opts`]["_grpc-type"];
3385
+ delete proxy[`${proxy.network}-opts`]["_grpc-authority"];
3284
3386
  }
3285
3387
  return proxy;
3286
3388
  });
@@ -3289,12 +3391,11 @@ function Clash_Producer() {
3289
3391
  return { type, produce: produce2 };
3290
3392
  }
3291
3393
 
3292
- // Sub-Store/backend/src/core/proxy-utils/producers/stash.js
3394
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/stash.js
3293
3395
  function Stash_Producer() {
3294
3396
  const type = "ALL";
3295
3397
  const produce2 = (proxies, type2, opts = {}) => {
3296
3398
  const list = proxies.filter((proxy) => {
3297
- if (opts["include-unsupported-proxy"]) return true;
3298
3399
  if (![
3299
3400
  "ss",
3300
3401
  "ssr",
@@ -3324,7 +3425,11 @@ function Stash_Producer() {
3324
3425
  "chacha20-ietf",
3325
3426
  "xchacha20",
3326
3427
  "chacha20-ietf-poly1305",
3327
- "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
+ ] : []
3328
3433
  ].includes(proxy.cipher) || proxy.type === "snell" && String(proxy.version) === "4" || proxy.type === "vless" && proxy["reality-opts"]) {
3329
3434
  return false;
3330
3435
  }
@@ -3488,6 +3593,7 @@ function Stash_Producer() {
3488
3593
  }
3489
3594
  if (["grpc"].includes(proxy.network) && proxy[`${proxy.network}-opts`]) {
3490
3595
  delete proxy[`${proxy.network}-opts`]["_grpc-type"];
3596
+ delete proxy[`${proxy.network}-opts`]["_grpc-authority"];
3491
3597
  }
3492
3598
  return proxy;
3493
3599
  });
@@ -3496,13 +3602,13 @@ function Stash_Producer() {
3496
3602
  return { type, produce: produce2 };
3497
3603
  }
3498
3604
 
3499
- // Sub-Store/backend/src/core/proxy-utils/producers/loon.js
3605
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/loon.js
3500
3606
  var targetPlatform3 = "Loon";
3501
3607
  function Loon_Producer() {
3502
- const produce2 = (proxy) => {
3608
+ const produce2 = (proxy, type, opts = {}) => {
3503
3609
  switch (proxy.type) {
3504
3610
  case "ss":
3505
- return shadowsocks2(proxy);
3611
+ return shadowsocks2(proxy, opts["include-unsupported-proxy"]);
3506
3612
  case "ssr":
3507
3613
  return shadowsocksr(proxy);
3508
3614
  case "trojan":
@@ -3526,7 +3632,7 @@ function Loon_Producer() {
3526
3632
  };
3527
3633
  return { produce: produce2 };
3528
3634
  }
3529
- function shadowsocks2(proxy) {
3635
+ function shadowsocks2(proxy, includeUnsupportedProxy) {
3530
3636
  const result = new Result(proxy);
3531
3637
  if (![
3532
3638
  "rc4",
@@ -3548,7 +3654,8 @@ function shadowsocks2(proxy) {
3548
3654
  "aes-192-gcm",
3549
3655
  "aes-256-gcm",
3550
3656
  "chacha20-ietf-poly1305",
3551
- "xchacha20-ietf-poly1305"
3657
+ "xchacha20-ietf-poly1305",
3658
+ ...includeUnsupportedProxy ? ["2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm"] : []
3552
3659
  ].includes(proxy.cipher)) {
3553
3660
  throw new Error(`cipher ${proxy.cipher} is not supported`);
3554
3661
  }
@@ -3875,7 +3982,7 @@ function hysteria22(proxy) {
3875
3982
  return result.toString();
3876
3983
  }
3877
3984
 
3878
- // Sub-Store/backend/src/core/proxy-utils/producers/uri.js
3985
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/uri.js
3879
3986
  import { Base64 as Base643 } from "js-base64";
3880
3987
  function URI_Producer() {
3881
3988
  const type = "SINGLE";
@@ -3902,7 +4009,9 @@ function URI_Producer() {
3902
4009
  switch (proxy.type) {
3903
4010
  case "ss":
3904
4011
  const userinfo = `${proxy.cipher}:${proxy.password}`;
3905
- result = `ss://${Base643.encode(userinfo)}@${proxy.server}:${proxy.port}${proxy.plugin ? "/" : ""}`;
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 ? "/" : ""}`;
3906
4015
  if (proxy.plugin) {
3907
4016
  result += "?plugin=";
3908
4017
  const opts = proxy["plugin-opts"];
@@ -3952,7 +4061,7 @@ function URI_Producer() {
3952
4061
  port: proxy.port,
3953
4062
  id: proxy.uuid,
3954
4063
  type: type2,
3955
- aid: 0,
4064
+ aid: proxy.alterId || 0,
3956
4065
  net,
3957
4066
  tls: proxy.tls ? "tls" : ""
3958
4067
  };
@@ -3971,6 +4080,7 @@ function URI_Producer() {
3971
4080
  if (["grpc"].includes(proxy.network)) {
3972
4081
  result.path = proxy[`${proxy.network}-opts`]?.["grpc-service-name"];
3973
4082
  result.type = proxy[`${proxy.network}-opts`]?.["_grpc-type"] || "gun";
4083
+ result.host = proxy[`${proxy.network}-opts`]?.["_grpc-authority"];
3974
4084
  }
3975
4085
  }
3976
4086
  result = "vmess://" + Base643.encode(JSON.stringify(result));
@@ -4026,6 +4136,12 @@ function URI_Producer() {
4026
4136
  vlessTransport += `&mode=${encodeURIComponent(
4027
4137
  proxy[`${proxy.network}-opts`]?.["_grpc-type"] || "gun"
4028
4138
  )}`;
4139
+ const authority = proxy[`${proxy.network}-opts`]?.["_grpc-authority"];
4140
+ if (authority) {
4141
+ vlessTransport += `&authority=${encodeURIComponent(
4142
+ authority
4143
+ )}`;
4144
+ }
4029
4145
  }
4030
4146
  let vlessTransportServiceName = proxy[`${proxy.network}-opts`]?.[`${proxy.network}-service-name`];
4031
4147
  let vlessTransportPath = proxy[`${proxy.network}-opts`]?.path;
@@ -4073,11 +4189,17 @@ function URI_Producer() {
4073
4189
  trojanTransport = `&type=${encodeURIComponent(trojanType)}`;
4074
4190
  if (["grpc"].includes(proxy.network)) {
4075
4191
  let trojanTransportServiceName = proxy[`${proxy.network}-opts`]?.[`${proxy.network}-service-name`];
4192
+ let trojanTransportAuthority = proxy[`${proxy.network}-opts`]?.["_grpc-authority"];
4076
4193
  if (trojanTransportServiceName) {
4077
4194
  trojanTransport += `&serviceName=${encodeURIComponent(
4078
4195
  trojanTransportServiceName
4079
4196
  )}`;
4080
4197
  }
4198
+ if (trojanTransportAuthority) {
4199
+ trojanTransport += `&authority=${encodeURIComponent(
4200
+ trojanTransportAuthority
4201
+ )}`;
4202
+ }
4081
4203
  trojanTransport += `&mode=${encodeURIComponent(
4082
4204
  proxy[`${proxy.network}-opts`]?.["_grpc-type"] || "gun"
4083
4205
  )}`;
@@ -4095,7 +4217,21 @@ function URI_Producer() {
4095
4217
  )}`;
4096
4218
  }
4097
4219
  }
4098
- result = `trojan://${proxy.password}@${proxy.server}:${proxy.port}?sni=${encodeURIComponent(proxy.sni || proxy.server)}${proxy["skip-cert-verify"] ? "&allowInsecure=1" : ""}${trojanTransport}#${encodeURIComponent(proxy.name)}`;
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
+ )}`;
4099
4235
  break;
4100
4236
  case "hysteria2":
4101
4237
  let hysteria2params = [];
@@ -4273,7 +4409,7 @@ function URI_Producer() {
4273
4409
  return { type, produce: produce2 };
4274
4410
  }
4275
4411
 
4276
- // Sub-Store/backend/src/core/proxy-utils/producers/v2ray.js
4412
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/v2ray.js
4277
4413
  import { Base64 as Base644 } from "js-base64";
4278
4414
  var URI = URI_Producer();
4279
4415
  function V2Ray_Producer() {
@@ -4299,7 +4435,7 @@ Reason: ${err}`
4299
4435
  return { type, produce: produce2 };
4300
4436
  }
4301
4437
 
4302
- // Sub-Store/backend/src/core/proxy-utils/producers/qx.js
4438
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/qx.js
4303
4439
  var targetPlatform4 = "QX";
4304
4440
  function QX_Producer() {
4305
4441
  const produce2 = (proxy, type, opts = {}) => {
@@ -4734,7 +4870,7 @@ function needTls(proxy) {
4734
4870
  return proxy.tls;
4735
4871
  }
4736
4872
 
4737
- // Sub-Store/backend/src/core/proxy-utils/producers/shadowrocket.js
4873
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/shadowrocket.js
4738
4874
  function ShadowRocket_Producer() {
4739
4875
  const type = "ALL";
4740
4876
  const produce2 = (proxies, type2, opts = {}) => {
@@ -4742,6 +4878,8 @@ function ShadowRocket_Producer() {
4742
4878
  if (opts["include-unsupported-proxy"]) return true;
4743
4879
  if (proxy.type === "snell" && String(proxy.version) === "4") {
4744
4880
  return false;
4881
+ } else if (["mieru"].includes(proxy.type)) {
4882
+ return false;
4745
4883
  }
4746
4884
  return true;
4747
4885
  }).map((proxy) => {
@@ -4867,6 +5005,7 @@ function ShadowRocket_Producer() {
4867
5005
  }
4868
5006
  if (["grpc"].includes(proxy.network) && proxy[`${proxy.network}-opts`]) {
4869
5007
  delete proxy[`${proxy.network}-opts`]["_grpc-type"];
5008
+ delete proxy[`${proxy.network}-opts`]["_grpc-authority"];
4870
5009
  }
4871
5010
  return proxy;
4872
5011
  });
@@ -4877,7 +5016,7 @@ function ShadowRocket_Producer() {
4877
5016
  return { type, produce: produce2 };
4878
5017
  }
4879
5018
 
4880
- // Sub-Store/backend/src/core/proxy-utils/producers/surfboard.js
5019
+ // src/vendors/Sub-Store/backend/src/core/proxy-utils/producers/surfboard.js
4881
5020
  var targetPlatform5 = "Surfboard";
4882
5021
  function Surfboard_Producer() {
4883
5022
  const produce2 = (proxy) => {
@@ -5049,9 +5188,9 @@ function handleTransport2(result, proxy) {
5049
5188
  }
5050
5189
  }
5051
5190
 
5052
- // 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
5053
5192
  var detourParser = (proxy, parsedProxy) => {
5054
- if (proxy["dialer-proxy"]) parsedProxy.detour = proxy["dialer-proxy"];
5193
+ parsedProxy.detour = proxy["dialer-proxy"] || proxy.detour;
5055
5194
  };
5056
5195
  var tfoParser = (proxy, parsedProxy) => {
5057
5196
  parsedProxy.tcp_fast_open = false;
@@ -5252,7 +5391,7 @@ var tlsParser = (proxy, parsedProxy) => {
5252
5391
  parsedProxy.tls.reality.short_id = proxy["reality-opts"]["short-id"];
5253
5392
  parsedProxy.tls.utls = { enabled: true };
5254
5393
  }
5255
- if (proxy["client-fingerprint"] && proxy["client-fingerprint"] !== "")
5394
+ if (!["hysteria", "hysteria2", "tuic"].includes(proxy.type) && proxy["client-fingerprint"] && proxy["client-fingerprint"] !== "")
5256
5395
  parsedProxy.tls.utls = {
5257
5396
  enabled: true,
5258
5397
  fingerprint: proxy["client-fingerprint"]
@@ -5583,7 +5722,7 @@ var hysteriaParser = (proxy = {}) => {
5583
5722
  smuxParser(proxy.smux, parsedProxy);
5584
5723
  return parsedProxy;
5585
5724
  };
5586
- var hysteria2Parser = (proxy = {}) => {
5725
+ var hysteria2Parser = (proxy = {}, includeUnsupportedProxy) => {
5587
5726
  const parsedProxy = {
5588
5727
  tag: proxy.name,
5589
5728
  type: "hysteria2",
@@ -5595,6 +5734,12 @@ var hysteria2Parser = (proxy = {}) => {
5595
5734
  };
5596
5735
  if (parsedProxy.server_port < 0 || parsedProxy.server_port > 65535)
5597
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
+ }
5598
5743
  if (proxy.up) parsedProxy.up_mbps = parseInt(`${proxy.up}`, 10);
5599
5744
  if (proxy.down) parsedProxy.down_mbps = parseInt(`${proxy.down}`, 10);
5600
5745
  if (proxy.obfs === "salamander") parsedProxy.obfs.type = "salamander";
@@ -5759,7 +5904,12 @@ function singbox_Producer() {
5759
5904
  list.push(hysteriaParser(proxy));
5760
5905
  break;
5761
5906
  case "hysteria2":
5762
- list.push(hysteria2Parser(proxy));
5907
+ list.push(
5908
+ hysteria2Parser(
5909
+ proxy,
5910
+ opts["include-unsupported-proxy"]
5911
+ )
5912
+ );
5763
5913
  break;
5764
5914
  case "tuic":
5765
5915
  if (!proxy.token || proxy.token.length === 0) {
@@ -5787,7 +5937,266 @@ function singbox_Producer() {
5787
5937
  return { type, produce: produce2 };
5788
5938
  }
5789
5939
 
5790
- // Sub-Store/backend/src/core/proxy-utils/producers/index.js
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
5791
6200
  function JSON_Producer() {
5792
6201
  const type = "ALL";
5793
6202
  const produce2 = (proxies, type2) => type2 === "internal" ? proxies : JSON.stringify(proxies, null, 2);
@@ -5808,7 +6217,8 @@ var producers_default = {
5808
6217
  Shadowrocket: ShadowRocket_Producer(),
5809
6218
  ShadowRocket: ShadowRocket_Producer(),
5810
6219
  Surfboard: Surfboard_Producer(),
5811
- "sing-box": singbox_Producer()
6220
+ "sing-box": singbox_Producer(),
6221
+ Egern: Egern_Producer()
5812
6222
  };
5813
6223
 
5814
6224
  // src/index.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sub-store-convert",
3
- "version": "2.14.420",
3
+ "version": "2.15.11",
4
4
  "description": "Advanced Subscription Converter for QX, Loon, Surge, Stash and ShadowRocket.",
5
5
  "module": "./build/index.js",
6
6
  "license": "MIT",