Skip to content

Commit 1732cbf

Browse files
committed
feat: URI 逻辑调整. AnyTLS URI/sing-box 支持传输层(mihomo, Shadowrocket 中自动过滤此类节点)
1 parent f8213a1 commit 1732cbf

6 files changed

Lines changed: 186 additions & 136 deletions

File tree

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store",
3-
"version": "2.20.10",
3+
"version": "2.20.11",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
55
"main": "src/main.js",
66
"scripts": {

backend/src/core/proxy-utils/parsers/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,8 @@ function URI_AnyTLS() {
753753
return /^anytls:\/\//.test(line);
754754
};
755755
const parse = (line) => {
756+
const parsed = URI_VLESS().parse(line.replace('anytls', 'vless'));
757+
// 偷个懒
756758
line = line.split(/anytls:\/\//)[1];
757759
// eslint-disable-next-line no-unused-vars
758760
let [__, password, server, port, addons = '', name] =
@@ -769,6 +771,8 @@ function URI_AnyTLS() {
769771
name = name ?? `AnyTLS ${server}:${port}`;
770772

771773
const proxy = {
774+
...parsed,
775+
uuid: undefined,
772776
type: 'anytls',
773777
name,
774778
server,
@@ -786,7 +790,7 @@ function URI_AnyTLS() {
786790
proxy['skip-cert-verify'] = /(TRUE)|1/i.test(value);
787791
} else if (['udp'].includes(key)) {
788792
proxy[key] = /(TRUE)|1/i.test(value);
789-
} else {
793+
} else if (!Object.keys(proxy).includes(key)) {
790794
proxy[key] = value;
791795
}
792796
}
@@ -940,7 +944,7 @@ function URI_Hysteria() {
940944
proxy['_obfs'] = value || '';
941945
} else if (['fast-open', 'peer'].includes(key)) {
942946
params[key] = value;
943-
} else {
947+
} else if (!Object.keys(proxy).includes(key)) {
944948
proxy[key] = value;
945949
}
946950
}
@@ -1007,7 +1011,7 @@ function URI_TUIC() {
10071011
} else if (key === 'congestion-control') {
10081012
proxy['congestion-controller'] = value;
10091013
delete proxy[key];
1010-
} else {
1014+
} else if (!Object.keys(proxy).includes(key)) {
10111015
proxy[key] = value;
10121016
}
10131017
}
@@ -1090,7 +1094,7 @@ function URI_WireGuard() {
10901094
proxy['private-key'] = value;
10911095
} else if (['udp'].includes(key)) {
10921096
proxy[key] = /(TRUE)|1/i.test(value);
1093-
} else if (!['flag'].includes(key)) {
1097+
} else if (![...Object.keys(proxy), 'flag'].includes(key)) {
10941098
proxy[key] = value;
10951099
}
10961100
}

backend/src/core/proxy-utils/producers/clashmeta.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ export default function ClashMeta_Producer() {
5959
) {
6060
// https://wiki.metacubex.one/config/proxies/ss/#cipher
6161
return false;
62+
} else if (
63+
['anytls'].includes(proxy.type) &&
64+
proxy['network']
65+
) {
66+
return false;
6267
}
6368
return true;
6469
})

backend/src/core/proxy-utils/producers/shadowrocket.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ export default function Shadowrocket_Producer() {
126126
delete proxy['shadow-tls-sni'];
127127
delete proxy['shadow-tls-version'];
128128
}
129+
} else if (
130+
['anytls'].includes(proxy.type) &&
131+
proxy['network']
132+
) {
133+
return false;
129134
}
130135

131136
if (

backend/src/core/proxy-utils/producers/sing-box.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ const anytlsParser = (proxy = {}) => {
736736
`${proxy['min-idle-session']}`,
737737
10,
738738
);
739+
networkParser(proxy, parsedProxy);
739740
detourParser(proxy, parsedProxy);
740741
tlsParser(proxy, parsedProxy);
741742
ipVersionParser(proxy, parsedProxy);

0 commit comments

Comments
 (0)