Skip to content

Commit 54b5cbd

Browse files
committed
feat: Egern 支持 AnyTLS. 根据请求的 User-Agent 中的版本号自动开启, 或使用 includeUnsupportedProxy 参数或开启 包含官方/商店版不支持的协议 开关
1 parent 7ce2fa6 commit 54b5cbd

3 files changed

Lines changed: 35 additions & 11 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.21.28",
3+
"version": "2.21.29",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
55
"main": "src/main.js",
66
"scripts": {

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export default function Egern_Producer() {
1818
'vmess',
1919
'tuic',
2020
'wireguard',
21-
// ...(opts['include-unsupported-proxy']
22-
// ? ['wireguard']
23-
// : []),
21+
...(opts['include-unsupported-proxy']
22+
? ['anytls']
23+
: []),
2424
].includes(proxy.type) ||
2525
(proxy.type === 'ss' &&
2626
((proxy.plugin === 'obfs' &&
@@ -75,6 +75,14 @@ export default function Egern_Producer() {
7575
proxy.token.length !== 0)
7676
) {
7777
return false;
78+
} else if (
79+
['anytls'].includes(proxy.type) &&
80+
proxy.network &&
81+
(!['tcp'].includes(proxy.network) ||
82+
(['tcp'].includes(proxy.network) &&
83+
proxy['reality-opts']))
84+
) {
85+
return false;
7886
} else if (
7987
['ws'].includes(proxy.network) &&
8088
proxy['ws-opts']?.['v2ray-http-upgrade']
@@ -207,6 +215,20 @@ export default function Egern_Producer() {
207215
skip_tls_verify: proxy['skip-cert-verify'],
208216
websocket: proxy.websocket,
209217
};
218+
} else if (proxy.type === 'anytls') {
219+
proxy = {
220+
type: 'anytls',
221+
name: proxy.name,
222+
server: proxy.server,
223+
port: proxy.port,
224+
password: proxy.password,
225+
tfo: proxy.tfo || proxy['fast-open'],
226+
udp_relay:
227+
proxy.udp || proxy.udp_relay || proxy.udp_relay,
228+
next_hop: proxy.next_hop,
229+
sni: proxy.sni,
230+
skip_tls_verify: proxy['skip-cert-verify'],
231+
};
210232
} else if (proxy.type === 'vmess') {
211233
// Egern:传输层,支持 ws/wss/http1/http2/tls,不配置则为 tcp
212234
let security = proxy.cipher;
@@ -428,6 +450,7 @@ export default function Egern_Producer() {
428450
'trojan',
429451
'vless',
430452
'vmess',
453+
'anytls',
431454
].includes(original.type)
432455
) {
433456
if (isPresent(original, 'shadow-tls-password')) {
@@ -463,6 +486,7 @@ export default function Egern_Producer() {
463486
'wireguard',
464487
'tuic',
465488
'hysteria2',
489+
'anytls',
466490
].includes(original.type)
467491
) {
468492
if (

backend/src/utils/user-agent.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ export function shouldIncludeUnsupportedProxy(platform, ua) {
7575
) {
7676
return true;
7777
}
78-
// if (
79-
// platform === 'Egern' &&
80-
// target === 'Egern' &&
81-
// ua.match(/build\/(\d+)/i)?.[1] >= 698
82-
// ) {
83-
// return true;
84-
// }
78+
if (
79+
platform === 'Egern' &&
80+
target === 'Egern' &&
81+
ua.match(/build\/(\d+)/i)?.[1] >= 718
82+
) {
83+
return true;
84+
}
8585
// // if (
8686
// // platform === 'Stash' &&
8787
// // target === 'Stash' &&

0 commit comments

Comments
 (0)