feat: Surge 支持 VLESS; Surge Trust Tunnel 支持 client-random-auth-key

This commit is contained in:
xream committed 2026-11-12 18:40:27 +08:00
1 parent d8fc0e69a7
commit 091e6f8d8c
9 files changed
+299 -41

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.44.7",
"version": "2.44.8",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"packageManager": "pnpm@11.0.9",
+4
View File
@@ -36,6 +36,7 @@ import Gist from '@/utils/gist';
import {
isShadowsocksOverTls,
normalizeWireGuardInterface,
supportsTrustTunnelClientRandomAuth,
} from './producers/utils';
import { doh } from '@/utils/dns';
import JSON5 from 'json5';
@@ -431,6 +432,9 @@ function produce(proxies, targetPlatform, type, opts = {}) {
// filter unsupported proxies
proxies = proxies.filter((proxy) => {
if (!supportsTrustTunnelClientRandomAuth(proxy, targetPlatform)) {
return false;
}
const includeUnsupportedProxy = opts['include-unsupported-proxy'];
// 检查代理是否支持目标平台
+13 -3
View File
@@ -1986,9 +1986,6 @@ function URI_VLESS() {
}
if (params.serviceName) {
opts[`${proxy.network}-service-name`] = params.serviceName;
if (['grpc'].includes(proxy.network) && params.authority) {
opts['_grpc-authority'] = params.authority;
}
} else if (isShadowrocket && params.path) {
if (!['ws', 'http', 'h2'].includes(proxy.network)) {
opts[`${proxy.network}-service-name`] = params.path;
@@ -2012,6 +2009,9 @@ function URI_VLESS() {
// https://github.com/XTLS/Xray-core/issues/91
if (['grpc'].includes(proxy.network)) {
opts['_grpc-type'] = params.mode || 'gun';
if (params.authority) {
opts['_grpc-authority'] = params.authority;
}
}
if (httpupgrade) {
opts['v2ray-http-upgrade'] = true;
@@ -2995,6 +2995,15 @@ function Surge_VMess() {
return { name, test, parse };
}
function Surge_VLESS() {
const name = 'Surge VLESS Parser';
const test = (line) =>
/^.*=\s*vless\s*$/.test(line.split(',')[0]) &&
/,\s*username\s*=/.test(line);
const parse = (line) => getSurgeParser().parse(line);
return { name, test, parse };
}
function Surge_Trojan() {
const name = 'Surge Trojan Parser';
const test = (line) => {
@@ -3175,6 +3184,7 @@ export default [
Surge_SSH(),
Surge_SS(),
Surge_VMess(),
Surge_VLESS(),
Surge_Trojan(),
Surge_Http(),
Surge_Snell(),
@@ -369,7 +369,7 @@ const grammars = String.raw`
}
}
start = (masque/anytls/shadowsocks/vmess/trojan/h2_connect/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/trust_tunnel/direct) {
start = (masque/anytls/shadowsocks/vmess/vless/trojan/h2_connect/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/trust_tunnel/direct) {
return proxy;
}
@@ -396,6 +396,13 @@ vmess = tag equals "vmess" address (vmess_uuid/vmess_aead/ws/ws_path/ws_headers/
handleWebsocket();
handleShadowTLS();
}
vless = tag equals "vless" address (vless_username/vless_option/reality_option/ws/ws_path/ws_headers/grpc/grpc_service_name/grpc_mode/grpc_authority/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls/sni/cert_verify_name/alpn/tls_fingerprint/tls_verification/client_cert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "vless";
proxy["packet-encoding"] = "xudp";
if (proxy["reality-opts"] && proxy["reality-opts"]["public-key"]) proxy.tls = true;
handleWebsocket();
handleShadowTLS();
}
trojan = tag equals "trojan" address (passwordk/ws/ws_path/ws_headers/tls/sni/cert_verify_name/alpn/tls_fingerprint/tls_verification/client_cert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "trojan";
handleWebsocket();
@@ -459,7 +466,7 @@ anytls = tag equals "anytls" address (passwordk/reuse/ip_version/underlying_prox
proxy.type = "anytls";
proxy.tls = true;
}
trust_tunnel = tag equals "trust-tunnel" address (usernamek/passwordk/headers/max_streams/reuse/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls_fingerprint/tls_verification/client_cert/sni/cert_verify_name/alpn/h3/fast_open/tfo/block_quic/others)* {
trust_tunnel = tag equals "trust-tunnel" address (usernamek/passwordk/client_random_auth_key/headers/max_streams/reuse/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls_fingerprint/tls_verification/client_cert/sni/cert_verify_name/alpn/h3/fast_open/tfo/block_quic/others)* {
proxy.type = "trusttunnel";
proxy.tls = true;
}
@@ -558,6 +565,11 @@ usernamek = comma "username" equals match:[^,]+ { proxy.username = match.join(""
passwordk = comma "password" equals match:[^,]+ { proxy.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
vmess_uuid = comma "username" equals match:[^,]+ { proxy.uuid = match.join(""); }
vmess_aead = comma "vmess-aead" equals flag:bool { proxy.aead = flag; }
// shortcut: keep text IDs as given, convert them to UUIDv5 when a target requires it.
vless_username = comma "username" equals value:quoted_value { proxy.uuid = value.trim(); }
vless_option = comma key:("flow"/"encryption") equals value:quoted_value { proxy[key] = value.trim(); }
reality_option = comma "reality-" key:("public-key"/"short-id") equals value:quoted_value { $set(proxy, "reality-opts." + key, value.trim()); }
client_random_auth_key = comma "client-random-auth-key" equals value:$[^,]* { proxy["client-random-auth-key"] = stripQuotes(value); }
method = comma "encrypt-method" equals cipher:cipher {
proxy.cipher = cipher;
@@ -567,7 +579,7 @@ vmess_method = comma "encrypt-method" equals cipher:$[^,]+ {
}
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"/"bf-cfb"/"camellia-128-cfb"/"camellia-192-cfb"/"camellia-256-cfb"/"cast5-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"des-cfb"/"idea-cfb"/"none"/"rc2-cfb"/"rc4-md5"/"rc4"/"salsa20"/"seed-cfb"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm");
ws = comma "ws" equals flag:bool { obfs.type = "ws"; }
ws = comma "ws" equals flag:bool { if (flag) obfs.type = "ws"; }
ws_headers = comma "ws-headers" equals & {
const start = peg$currPos;
const index = readHeadersEnd(input, start, "|");
@@ -577,6 +589,10 @@ ws_headers = comma "ws-headers" equals & {
return $.headers.trim().length > 0;
} { obfs["ws-headers"] = parseHeaders($.headers, "|"); }
ws_path = comma "ws-path" equals path:uri { obfs.path = path.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
grpc = comma "grpc" equals flag:bool { if (flag) proxy.network = "grpc"; }
grpc_service_name = comma "grpc-service-name" equals value:quoted_value { $set(proxy, "grpc-opts.grpc-service-name", value.trim()); }
grpc_mode = comma "grpc-mode" equals value:quoted_value { $set(proxy, "grpc-opts._grpc-type", value.trim()); }
grpc_authority = comma "grpc-authority" equals value:quoted_value { $set(proxy, "grpc-opts._grpc-authority", value.trim()); }
headers = comma "headers" equals & {
const start = peg$currPos;
const index = readHeadersEnd(input, start, ";");
@@ -6,6 +6,7 @@ import {
produceProxyListOutput,
restoreShadowTLSProxyOpts,
supportsShadowsocksV2rayPluginMode,
supportsTrustTunnelClientRandomAuth,
} from '@/core/proxy-utils/producers/utils';
import { isNotBlank, isPlainObject } from '@/utils';
import {
@@ -55,6 +56,9 @@ export default function ClashMeta_Producer() {
const produce = (proxies, type, opts = {}) => {
const list = proxies
.filter((proxy) => {
if (!supportsTrustTunnelClientRandomAuth(proxy, 'Mihomo')) {
return false;
}
if (opts['include-unsupported-proxy']) return true;
if (proxy.type === 'h2-connect') {
+76 -18
View File
@@ -181,7 +181,8 @@ export default function Surge_Producer() {
case 'trojan':
return trojan(proxy);
case 'vmess':
return vmess(proxy, opts['include-unsupported-proxy']);
case 'vless':
return v2ray(proxy, opts['include-unsupported-proxy']);
case 'http':
return http(proxy);
case 'h2-connect':
@@ -452,6 +453,15 @@ function trusttunnel(proxy) {
result.append(`${proxy.name}=trust-tunnel,${proxy.server},${proxy.port}`);
result.appendIfPresent(`,username="${proxy.username}"`, 'username');
result.appendIfPresent(`,password="${proxy.password}"`, 'password');
if (isPresent(proxy, 'client-random-auth-key')) {
const key = stripSurgeQuotes(proxy['client-random-auth-key']);
if (typeof key !== 'string' || !/^[0-9a-f]+$/i.test(key)) {
throw new Error(
'TrustTunnel client-random-auth-key must be a hex string',
);
}
result.append(`,client-random-auth-key=${key}`);
}
appendHeaders(result, proxy);
warnMaxStreamsIfNeeded(proxy);
result.appendIfPresent(
@@ -617,13 +627,16 @@ function h2Connect(proxy) {
return result.toString();
}
function vmess(proxy, includeUnsupportedProxy) {
function v2ray(proxy, includeUnsupportedProxy) {
const isVless = proxy.type === 'vless';
const result = new Result(proxy);
result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
result.appendIfPresent(`,username=${proxy.uuid}`, 'uuid');
const encryptMethod = formatSurgeVmessEncryptMethod(proxy.cipher);
if (encryptMethod) {
result.append(`,encrypt-method=${encryptMethod}`);
if (!isVless) {
const encryptMethod = formatSurgeVmessEncryptMethod(proxy.cipher);
if (encryptMethod) {
result.append(`,encrypt-method=${encryptMethod}`);
}
}
const ip_version = ipVersions[proxy['ip-version']] || proxy['ip-version'];
@@ -634,22 +647,18 @@ function vmess(proxy, includeUnsupportedProxy) {
'no-error-alert',
);
// transport
handleTransport(result, proxy, includeUnsupportedProxy);
// AEAD
if (isPresent(proxy, 'aead')) {
result.append(`,vmess-aead=${proxy.aead}`);
if (isVless) {
appendVlessParams(result, proxy);
} else {
result.append(`,vmess-aead=${proxy.alterId === 0}`);
handleTransport(result, proxy, includeUnsupportedProxy);
const aead = isPresent(proxy, 'aead')
? proxy.aead
: proxy.alterId === 0;
result.append(`,vmess-aead=${aead}`);
result.appendIfPresent(`,tls=${proxy.tls}`, 'tls');
appendTlsProxyParams(result, proxy, Boolean(proxy.tls));
}
// tls
result.appendIfPresent(`,tls=${proxy.tls}`, 'tls');
// tls verification
appendTlsProxyParams(result, proxy, Boolean(proxy.tls));
// tfo
result.appendIfPresent(`,tfo=${proxy.tfo}`, 'tfo');
@@ -686,6 +695,55 @@ function vmess(proxy, includeUnsupportedProxy) {
return result.toString();
}
function appendVlessParams(result, proxy) {
const network = proxy.network ?? 'tcp';
const reality = proxy['reality-opts'];
const tls = proxy.tls || reality;
if (!['tcp', 'raw', 'none', 'ws', 'grpc'].includes(network)) {
throw unsupported(`VLESS network ${network} is unsupported`);
}
if (proxy.encryption && proxy.encryption !== 'none') {
throw unsupported('VLESS encryption is unsupported');
}
if (
(network === 'ws' && reality) ||
(network === 'grpc' && !tls) ||
(proxy.flow && (!tls || network === 'ws' || network === 'grpc'))
) {
throw unsupported(
'Unsupported VLESS transport, TLS or flow combination',
);
}
if (network === 'ws') {
handleTransport(result, proxy);
} else if (network === 'grpc') {
result.append(',grpc=true');
const grpc = proxy['grpc-opts'];
for (const [key, value] of [
['grpc-service-name', grpc?.['grpc-service-name']],
['grpc-mode', grpc?.['_grpc-type']],
['grpc-authority', grpc?.['_grpc-authority']],
]) {
if (value) result.append(`,${key}=${value}`);
}
}
if (proxy.flow) result.append(`,flow=${proxy.flow}`);
if (proxy.encryption) result.append(`,encryption=${proxy.encryption}`);
if (reality) {
result.append(`,reality-public-key=${reality['public-key']}`);
if (reality['short-id']) {
result.append(`,reality-short-id=${reality['short-id']}`);
}
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
appendAlpn(result, proxy);
} else {
result.appendIfPresent(`,tls=${proxy.tls}`, 'tls');
appendTlsProxyParams(result, proxy, Boolean(tls));
}
}
function ssh(proxy) {
const result = new Result(proxy);
result.append(`${proxy.name}=ssh,${proxy.server},${proxy.port}`);
@@ -1,4 +1,5 @@
import _ from 'lodash';
import $ from '@/core/app';
import YAML from '@/utils/yaml';
import { isIPv4, isIPv6 } from '@/utils';
import { normalizeClashYaml } from '@/core/proxy-utils/preprocessors';
@@ -32,6 +33,22 @@ export function isPresent(obj, attr) {
return typeof data !== 'undefined' && data !== null;
}
export function supportsTrustTunnelClientRandomAuth(proxy, targetPlatform) {
if (
proxy.type !== 'trusttunnel' ||
!isPresent(proxy, 'client-random-auth-key') ||
['surge', 'surgemac', 'json'].includes(targetPlatform.toLowerCase())
) {
return true;
}
$.error(
`Target platform ${targetPlatform} does not support client-random-auth-key for TrustTunnel proxy ${
proxy.name || `${proxy.server}:${proxy.port}`
}. Proxy has been filtered.`,
);
return false;
}
export function isShadowsocksOverTls(proxy) {
const normalizedNetwork =
typeof proxy?.network === 'string'
+152 -9
View File
@@ -5,7 +5,12 @@ import { describe, it } from 'mocha';
import $ from '@/core/app';
import { ProxyUtils } from '@/core/proxy-utils';
import QX_Producer from '@/core/proxy-utils/producers/qx';
import { produceExternal, UUID } from './helpers';
import {
expectSubset,
produceExternal,
produceInternal,
UUID,
} from './helpers';
function captureWarns(fn) {
const originalWarn = $.warn;
@@ -1653,6 +1658,64 @@ describe('Proxy text producers', function () {
]);
});
it('round-trips TrustTunnel client-random-auth-key in Surge and preserves it in JSON', function () {
const key = '00112233445566778899aabbccddeeff';
const [proxy] = ProxyUtils.parse(
`Keyed TrustTunnel=trust-tunnel,trust.example.com,443,username=user,password=pass,client-random-auth-key='${key}',h3=true`,
);
expect(proxy['client-random-auth-key']).to.equal(key);
for (const target of ['Surge', 'SurgeMac']) {
const output = produceExternal(target, proxy, {
useMihomoExternal: true,
});
expect(output).to.include(`,client-random-auth-key=${key},h3=true`);
expect(
ProxyUtils.parse(output)[0]['client-random-auth-key'],
).to.equal(key);
}
expect(
produceInternal('JSON', proxy)[0]['client-random-auth-key'],
).to.equal(key);
});
it('filters keyed TrustTunnel nodes from unsupported targets, including SurgeMac Mihomo external mode', function () {
const plain = {
type: 'trusttunnel',
name: 'Plain TrustTunnel',
server: 'trust.example.com',
port: 443,
username: 'user',
password: 'pass',
};
const key = '00112233445566778899aabbccddeeff';
const keyed = {
...plain,
name: 'Keyed TrustTunnel',
'client-random-auth-key': key,
};
const opts = { 'include-unsupported-proxy': true };
for (const target of ['Mihomo', 'Shadowrocket', 'SurgeMac']) {
const { result, errors } = captureErrors(() =>
produceInternal(target, [keyed, plain], {
...opts,
mihomoExternal: target === 'SurgeMac',
}),
);
expect(result).to.have.length(1);
if (target === 'SurgeMac') {
expect(result[0]).to.include(`${plain.name}=external,`);
} else {
expect(result[0].name).to.equal(plain.name);
}
expect(errors).to.have.length(1);
expect(errors[0])
.to.include(target === 'SurgeMac' ? 'Mihomo' : target)
.and.to.include('client-random-auth-key')
.and.to.include(keyed.name)
.and.not.to.include(key);
}
});
it('warns when Surge max-streams is greater than 3', function () {
const { result: output, warnings } = captureWarns(() =>
ProxyUtils.produce(
@@ -2272,7 +2335,92 @@ describe('Proxy text producers', function () {
);
});
it('wraps unsupported SurgeMac protocols with Mihomo external mode when requested', function () {
it('round-trips Surge VLESS with RAW, WebSocket, gRPC and REALITY', function () {
const cases = [
[
'ws=false,tls=true,flow=xtls-rprx-vision-udp443,encryption=none',
{
network: 'tcp',
tls: true,
flow: 'xtls-rprx-vision-udp443',
encryption: 'none',
},
],
[
'ws=true,ws-path=/edge,ws-headers=Host:cdn.example.com,tls=true',
{
network: 'ws',
tls: true,
'ws-opts': {
path: '/edge',
headers: { Host: 'cdn.example.com' },
},
},
],
[
'grpc=true,grpc-service-name=/edge/tun|tunmulti,grpc-mode=multi,grpc-authority=grpc.example.com,reality-public-key=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=,reality-short-id="0012",sni=sni.example.com',
{
network: 'grpc',
tls: true,
sni: 'sni.example.com',
'grpc-opts': {
'grpc-service-name': '/edge/tun|tunmulti',
'_grpc-type': 'multi',
'_grpc-authority': 'grpc.example.com',
},
'reality-opts': {
'public-key':
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=',
'short-id': '0012',
},
},
],
];
for (const [params, fields] of cases) {
const [proxy] = ProxyUtils.parse(
`Surge VLESS = vless,vless.example.com,443,username="${UUID}",${params}`,
);
const expected = {
type: 'vless',
uuid: UUID,
'packet-encoding': 'xudp',
...fields,
};
expectSubset(proxy, expected);
for (const target of ['Surge', 'SurgeMac']) {
const output = produceExternal(target, proxy, {
useMihomoExternal: true,
});
expect(output).to.match(/^Surge VLESS=vless,/);
expect(output).not.to.include('vmess-aead=');
expectSubset(ProxyUtils.parse(output)[0], expected);
}
}
});
it('produces native Surge VLESS from a RAW REALITY share link', function () {
const [proxy] = ProxyUtils.parse(
`vless://${UUID}@192.0.2.1:443?type=raw&security=reality&pbk=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&sid=0012&sni=sni.example.com&flow=xtls-rprx-vision#RAW`,
);
const output = produceExternal('Surge', proxy);
expect(output).to.equal(
`RAW=vless,192.0.2.1,443,username=${UUID},flow=xtls-rprx-vision,reality-public-key=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,reality-short-id=0012,sni="sni.example.com"`,
);
});
it('preserves gRPC authority from a VLESS share link without a service name', function () {
const [proxy] = ProxyUtils.parse(
`vless://${UUID}@edge.example.com:443?type=grpc&security=tls&authority=grpc.example.com#VLESS`,
);
const output = produceExternal('Surge', proxy);
expect(output).to.include(',grpc-authority=grpc.example.com');
expect(output).not.to.include('grpc-service-name=');
});
it('wraps unsupported SurgeMac VLESS transports with Mihomo external mode when requested', function () {
const output = produceExternal(
'SurgeMac',
{
@@ -2282,13 +2430,8 @@ describe('Proxy text producers', function () {
port: 443,
uuid: UUID,
tls: true,
network: 'ws',
'ws-opts': {
path: '/ws',
headers: {
Host: 'cdn.example.com',
},
},
network: 'xhttp',
'xhttp-opts': { path: '/xhttp', host: 'cdn.example.com' },
},
{ useMihomoExternal: true, localPort: 16666 },
);
+13 -7
View File
@@ -5,6 +5,7 @@ import { COLLECTIONS_KEY, FILES_KEY, SUBS_KEY } from '@/constants';
const UUID = '11111111-1111-4111-8111-111111111111';
const VLESS_WS = `vless://${UUID}@1.1.1.1:443?security=tls&type=ws&host=cdn.example.com&path=%2Fws&sni=sni.example.com#VLESS%20WS`;
const VLESS_XHTTP = `vless://${UUID}@192.0.2.1:443?security=tls&type=xhttp&path=%2Fxhttp&sni=sni.example.com#VLESS%20XHTTP`;
let $;
let openApi;
@@ -580,44 +581,48 @@ describe('download routes', function () {
});
it('keeps SurgeMac Mihomo external output unmerged by default', async function () {
state[SUBS_KEY][0].content = [VLESS_WS, VLESS_XHTTP].join('\n');
const output = await downloadSubscription({ target: 'SurgeMac' });
expect(output).to.include('VLESS WS=vless,');
expect(output).to.include(
'VLESS WS=external,exec="/usr/local/bin/mihomo"',
'VLESS XHTTP=external,exec="/usr/local/bin/mihomo"',
);
expect(output).to.not.include('VLESS WS=socks5');
expect(output).to.not.include('VLESS XHTTP=socks5');
expect(output).to.not.include('mihomo merged=external');
});
it('enables merged Mihomo external output when the query parameter is present', async function () {
state[SUBS_KEY][0].content = VLESS_XHTTP;
const output = await downloadSubscription({
target: 'SurgeMac',
mihomoMerge: 'true',
mihomoMergeName: 'Shared Mihomo',
});
expect(output).to.include('VLESS WS=socks5,127.0.0.1,65535');
expect(output).to.include('VLESS XHTTP=socks5,127.0.0.1,65535');
expect(output).to.include(
'Shared Mihomo=external,exec="/usr/local/bin/mihomo"',
);
expect(output).to.not.include(
'VLESS WS=external,exec="/usr/local/bin/mihomo"',
'VLESS XHTTP=external,exec="/usr/local/bin/mihomo"',
);
});
it('treats mihomoMerge=false as enabled because query flags are presence-based', async function () {
state[SUBS_KEY][0].content = VLESS_XHTTP;
const output = await downloadSubscription({
target: 'SurgeMac',
mihomoMerge: 'false',
mihomoMergeName: 'Shared Mihomo',
});
expect(output).to.include('VLESS WS=socks5,127.0.0.1,65535');
expect(output).to.include('VLESS XHTTP=socks5,127.0.0.1,65535');
expect(output).to.include(
'Shared Mihomo=external,exec="/usr/local/bin/mihomo"',
);
expect(output).to.not.include(
'VLESS WS=external,exec="/usr/local/bin/mihomo"',
'VLESS XHTTP=external,exec="/usr/local/bin/mihomo"',
);
});
@@ -636,13 +641,14 @@ describe('download routes', function () {
});
it('enables merged Mihomo external output for collection downloads', async function () {
state[SUBS_KEY][0].content = VLESS_XHTTP;
const output = await downloadCollection({
target: 'SurgeMac',
mihomoMerge: 'true',
mihomoMergeName: 'Shared Mihomo',
});
expect(output).to.include('VLESS WS=socks5,127.0.0.1,65535');
expect(output).to.include('VLESS XHTTP=socks5,127.0.0.1,65535');
expect(output).to.include(
'Shared Mihomo=external,exec="/usr/local/bin/mihomo"',
);