Skip to content

Commit 0825f15

Browse files
committed
feat: Egern 支持 Shadow TLS
1 parent fbf6b5c commit 0825f15

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

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.16.46",
3+
"version": "2.16.47",
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: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { isPresent } from './utils';
2+
13
export default function Egern_Producer() {
24
const type = 'ALL';
3-
const produce = (proxies, type, opts = {}) => {
5+
const produce = (proxies, type) => {
46
// https://egernapp.com/zh-CN/docs/configuration/proxies
57
const list = proxies
68
.filter((proxy) => {
@@ -71,6 +73,7 @@ export default function Egern_Producer() {
7173
return true;
7274
})
7375
.map((proxy) => {
76+
const original = { ...proxy };
7477
if (proxy.tls && !proxy.sni) {
7578
proxy.sni = proxy.server;
7679
}
@@ -326,6 +329,39 @@ export default function Egern_Producer() {
326329
// skip_tls_verify: proxy['skip-cert-verify'],
327330
};
328331
}
332+
if (
333+
[
334+
'http',
335+
'socks5',
336+
'ss',
337+
'trojan',
338+
'vless',
339+
'vmess',
340+
].includes(original.type)
341+
) {
342+
if (isPresent(original, 'shadow-tls-password')) {
343+
if (original['shadow-tls-version'] != 3)
344+
throw new Error(
345+
`shadow-tls version ${original['shadow-tls-version']} is not supported`,
346+
);
347+
proxy.shadow_tls = {
348+
password: original['shadow-tls-password'],
349+
sni: original['shadow-tls-sni'],
350+
};
351+
} else if (
352+
['shadow-tls'].includes(original.plugin) &&
353+
original['plugin-opts']
354+
) {
355+
if (original['plugin-opts'].version != 3)
356+
throw new Error(
357+
`shadow-tls version ${original['plugin-opts'].version} is not supported`,
358+
);
359+
proxy.shadow_tls = {
360+
password: original['plugin-opts'].password,
361+
sni: original['plugin-opts'].host,
362+
};
363+
}
364+
}
329365

330366
delete proxy.subName;
331367
delete proxy.collectionName;

0 commit comments

Comments
 (0)