Skip to content

Commit

Permalink
feat: Egern 支持 Shadow TLS
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Feb 18, 2025
1 parent fbf6b5c commit 0825f15
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.16.46",
"version": "2.16.47",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
Expand Down
38 changes: 37 additions & 1 deletion backend/src/core/proxy-utils/producers/egern.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { isPresent } from './utils';

export default function Egern_Producer() {
const type = 'ALL';
const produce = (proxies, type, opts = {}) => {
const produce = (proxies, type) => {
// https://egernapp.com/zh-CN/docs/configuration/proxies
const list = proxies
.filter((proxy) => {
Expand Down Expand Up @@ -71,6 +73,7 @@ export default function Egern_Producer() {
return true;
})
.map((proxy) => {
const original = { ...proxy };
if (proxy.tls && !proxy.sni) {
proxy.sni = proxy.server;
}
Expand Down Expand Up @@ -326,6 +329,39 @@ export default function Egern_Producer() {
// skip_tls_verify: proxy['skip-cert-verify'],
};
}
if (
[
'http',
'socks5',
'ss',
'trojan',
'vless',
'vmess',
].includes(original.type)
) {
if (isPresent(original, 'shadow-tls-password')) {
if (original['shadow-tls-version'] != 3)
throw new Error(
`shadow-tls version ${original['shadow-tls-version']} is not supported`,
);
proxy.shadow_tls = {
password: original['shadow-tls-password'],
sni: original['shadow-tls-sni'],
};
} else if (
['shadow-tls'].includes(original.plugin) &&
original['plugin-opts']
) {
if (original['plugin-opts'].version != 3)
throw new Error(
`shadow-tls version ${original['plugin-opts'].version} is not supported`,
);
proxy.shadow_tls = {
password: original['plugin-opts'].password,
sni: original['plugin-opts'].host,
};
}
}

delete proxy.subName;
delete proxy.collectionName;
Expand Down

0 comments on commit 0825f15

Please sign in to comment.