feat: trust-tunnel -> trusttunnel; mihomo 支持 trusttunnel; 修复 Surge trusttunnel 用户名; 优化 shouldIncludeUnsupportedProxy 逻辑

This commit is contained in:
xream committed 2026-03-03 05:14:13 +08:00
1 parent 5704c0575c
commit 5e8100ecb0
13 files changed
+26 -31

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.21.37",
"version": "2.21.39",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
+1 -1
View File
@@ -466,7 +466,7 @@ function lastParse(proxy) {
'hysteria2',
'juicity',
'anytls',
'trust-tunnel',
'trusttunnel',
'naive',
].includes(proxy.type)
) {
@@ -1266,7 +1266,7 @@ function Clash_All() {
}
if (
![
'trust-tunnel',
'trusttunnel',
'naive',
'anytls',
'mieru',
@@ -123,7 +123,7 @@ anytls = tag equals "anytls" address (passwordk/reuse/ip_version/underlying_prox
proxy.tls = true;
}
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)* {
proxy.type = "trust-tunnel";
proxy.type = "trusttunnel";
proxy.tls = true;
}
@@ -121,7 +121,7 @@ anytls = tag equals "anytls" address (passwordk/reuse/ip_version/underlying_prox
proxy.tls = true;
}
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)* {
proxy.type = "trust-tunnel";
proxy.type = "trusttunnel";
proxy.tls = true;
}
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)* {
@@ -174,7 +174,7 @@ export default function Clash_Producer() {
'hysteria2',
'juicity',
'anytls',
'trust-tunnel',
'trusttunnel',
'naive',
].includes(proxy.type)
) {
@@ -16,9 +16,7 @@ export default function ClashMeta_Producer() {
if (opts['include-unsupported-proxy']) return true;
if (proxy.type === 'snell' && proxy.version >= 4) {
return false;
} else if (
['trust-tunnel', 'juicity', 'naive'].includes(proxy.type)
) {
} else if (['juicity', 'naive'].includes(proxy.type)) {
return false;
} else if (
['ss'].includes(proxy.type) &&
@@ -251,7 +249,7 @@ export default function ClashMeta_Producer() {
'hysteria2',
'juicity',
'anytls',
'trust-tunnel',
'trusttunnel',
'naive',
].includes(proxy.type)
) {
@@ -11,7 +11,7 @@ export default function Shadowrocket_Producer() {
return false;
} else if (
[
'trust-tunnel',
'trusttunnel',
'mieru',
'sudoku',
'naive',
@@ -227,7 +227,7 @@ export default function Shadowrocket_Producer() {
'hysteria2',
'juicity',
'anytls',
'trust-tunnel',
'trusttunnel',
'naive',
].includes(proxy.type)
) {
@@ -290,7 +290,7 @@ export default function Stash_Producer() {
'hysteria2',
'juicity',
'anytls',
'trust-tunnel',
'trusttunnel',
'naive',
].includes(proxy.type)
) {
@@ -67,11 +67,8 @@ export default function Surge_Producer() {
return anytls(proxy);
}
if (
opts['include-unsupported-proxy'] &&
proxy.type === 'trust-tunnel'
) {
return trust_tunnel(proxy);
if (opts['include-unsupported-proxy'] && proxy.type === 'trusttunnel') {
return trusttunnel(proxy);
}
throw new Error(
`Platform ${targetPlatform} does not support proxy type: ${proxy.type}`,
@@ -372,9 +369,10 @@ function anytls(proxy) {
return result.toString();
}
function trust_tunnel(proxy) {
function trusttunnel(proxy) {
const result = new Result(proxy);
result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
result.append(`${proxy.name}=trust-tunnel,${proxy.server},${proxy.port}`);
result.appendIfPresent(`,username="${proxy.username}"`, 'username');
result.appendIfPresent(`,password="${proxy.password}"`, 'password');
const ip_version = ipVersions[proxy['ip-version']] || proxy['ip-version'];
@@ -157,7 +157,7 @@ export default function URI_Producer() {
'hysteria2',
'juicity',
'anytls',
'trust-tunnel',
'trusttunnel',
].includes(proxy.type)
) {
delete proxy.tls;
+2 -2
View File
@@ -175,7 +175,7 @@ async function downloadSubscription(req, res) {
if (
!includeUnsupportedProxy &&
shouldIncludeUnsupportedProxy(platform, reqUA)
shouldIncludeUnsupportedProxy(platform, req.headers)
) {
includeUnsupportedProxy = true;
$.info(
@@ -478,7 +478,7 @@ async function downloadCollection(req, res) {
}
if (
!includeUnsupportedProxy &&
shouldIncludeUnsupportedProxy(platform, reqUA)
shouldIncludeUnsupportedProxy(platform, req.headers)
) {
includeUnsupportedProxy = true;
$.info(
+7 -8
View File
@@ -61,17 +61,17 @@ export function getPlatformFromHeaders(headers) {
return getPlatformFromUserAgent({ ua, UA, accept });
}
export function shouldIncludeUnsupportedProxy(platform, ua) {
export function shouldIncludeUnsupportedProxy(platform, headers) {
try {
const target = getPlatformFromUserAgent({
UA: ua,
ua: ua.toLowerCase(),
});
const { UA, ua, accept } = getUserAgentFromHeaders(headers);
const target = getPlatformFromUserAgent({ UA, ua, accept });
const coerceVersion = coerce(ua);
const { major } = coerceVersion;
if (
(target === 'SurgeMac' && major >= 9860) ||
(target === 'Surge' && major >= 3613)
(['SurgeMac', 'Surge'].includes(platform) &&
target === 'SurgeMac' &&
major >= 9860) ||
(platform === 'Surge' && target === 'Surge' && major >= 3613)
) {
return true;
}
@@ -90,7 +90,6 @@ export function shouldIncludeUnsupportedProxy(platform, ua) {
// // return true;
// // }
// // Loon 的 UA 不规范, version 取出来是 build
// // if (
// // platform === 'Loon' &&
// // target === 'Loon' &&