feat: 调整 AnyTLS 不同情况下的过滤逻辑(暂时先不扩展到 所有的 REALITY 的检测)

This commit is contained in:
xream committed 2026-05-11 18:50:51 +08:00
1 parent 58ab0a7f5c
commit 58fccc7141
8 files changed
+2075 -1549

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.22.28",
"version": "2.22.29",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"packageManager": "pnpm@11.0.9",
+2046 -1509
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -1,3 +1,4 @@
allowBuilds:
core-js: true
esbuild: true
nodemon: true
+13 -2
View File
@@ -29,8 +29,6 @@ export default function Loon_Producer() {
return shadowsocksr(proxy);
case 'trojan':
return trojan(proxy);
case 'anytls':
return anytls(proxy);
case 'vmess':
return vmess(proxy, opts['include-unsupported-proxy']);
case 'vless':
@@ -44,6 +42,19 @@ export default function Loon_Producer() {
case 'hysteria2':
return hysteria2(proxy);
}
if (proxy.type === 'anytls') {
if (
proxy.network &&
(!['tcp'].includes(proxy.network) ||
(['tcp'].includes(proxy.network) && proxy['reality-opts']))
) {
throw new Error(
`Platform ${targetPlatform} does not support proxy type ${proxy.type} with network or REALITY`,
);
}
return anytls(proxy);
}
throw new Error(
`Platform ${targetPlatform} does not support proxy type: ${proxy.type}`,
);
@@ -39,14 +39,6 @@ export default function Shadowrocket_Producer() {
].includes(proxy.type)
) {
return false;
} else if (
['anytls'].includes(proxy.type) &&
proxy.network &&
(!['tcp'].includes(proxy.network) ||
(['tcp'].includes(proxy.network) &&
proxy['reality-opts']))
) {
return false;
} else if (['xhttp'].includes(proxy.network)) {
$.warn(
`VLESS XHTTP 结构复杂, Shadowrocket 可能无法完全兼容`,
@@ -28,13 +28,24 @@ export default function Surfboard_Producer() {
return snell(proxy);
case 'socks5':
return socks5(proxy);
case 'anytls':
return anytls(proxy);
case 'hysteria2':
return hysteria2(proxy);
case 'wireguard-surge':
return wireguard(proxy);
}
if (proxy.type === 'anytls') {
if (
proxy.network &&
(!['tcp'].includes(proxy.network) ||
(['tcp'].includes(proxy.network) && proxy['reality-opts']))
) {
throw new Error(
`Platform ${targetPlatform} does not support proxy type ${proxy.type} with network or REALITY`,
);
}
return anytls(proxy);
}
throw new Error(
`Platform ${targetPlatform} does not support proxy type: ${proxy.type}`,
);
@@ -74,7 +74,7 @@ export default function Surge_Producer() {
(['tcp'].includes(proxy.network) && proxy['reality-opts']))
) {
throw unsupported(
`Platform ${targetPlatform} does not support proxy type ${proxy.type} with network or reality`,
`Platform ${targetPlatform} does not support proxy type ${proxy.type} with network or REALITY`,
);
}
@@ -421,32 +421,6 @@ describe('Proxy text producers', function () {
);
});
it('produces Loon AnyTLS lines and keeps only supported fields', function () {
const output = produceExternal('Loon', {
type: 'anytls',
name: 'Loon AnyTLS',
server: 'anytls.example.com',
port: 443,
password: 'secret',
tls: true,
sni: 'sni.example.com',
network: 'ws',
'ws-opts': {
path: '/anytls',
headers: {
Host: 'cdn.example.com',
},
},
'skip-cert-verify': true,
'idle-session-timeout': 30,
'max-stream-count': 16,
});
expect(output).to.equal(
'Loon AnyTLS=anytls,anytls.example.com,443,"secret",idle-session-timeout=30,max-stream-count=16,skip-cert-verify=true,tls-name=sni.example.com',
);
});
it('produces Surge TUIC v5 lines with port hopping', function () {
const output = produceExternal('Surge', {
type: 'tuic',