Skip to content

Commit 0f84a60

Browse files
committed
feat: Egern 过滤带 ShadowTLS 的 Snell 节点
1 parent 374001c commit 0f84a60

3 files changed

Lines changed: 77 additions & 1 deletion

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.24.12",
3+
"version": "2.24.13",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
55
"main": "src/main.js",
66
"packageManager": "pnpm@11.0.9",

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ export default function Egern_Producer() {
9292
normalizeSnellVersion(proxy.version) === null
9393
) {
9494
return false;
95+
} else if (proxy.type === 'snell' && hasShadowTls(proxy)) {
96+
$.error(
97+
`Platform Egern does not support Snell shadow-tls proxy ${proxy.name}. Proxy has been filtered.`,
98+
);
99+
return false;
95100
} else if (
96101
['anytls'].includes(proxy.type) &&
97102
proxy.network &&
@@ -687,6 +692,15 @@ function getUdpRelay(proxy) {
687692
return proxy.udp ?? proxy.udp_relay;
688693
}
689694

695+
function hasShadowTls(proxy) {
696+
return (
697+
proxy.plugin === 'shadow-tls' ||
698+
isPresent(proxy, 'shadow-tls-password') ||
699+
isPresent(proxy, 'shadow-tls-sni') ||
700+
isPresent(proxy, 'shadow-tls-version')
701+
);
702+
}
703+
690704
function getNonEmptyValue(value) {
691705
if (value == null) return undefined;
692706
if (typeof value === 'string' && value.length === 0) return undefined;

backend/src/test/proxy-producers/structured.spec.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,68 @@ describe('Proxy structured producers', function () {
21172117
}
21182118
});
21192119

2120+
it('filters Egern Snell shadow-tls variants', function () {
2121+
const proxies = [
2122+
{
2123+
type: 'snell',
2124+
name: 'Egern Snell ShadowTLS Fields',
2125+
server: 'snell-shadowtls.example.com',
2126+
port: 44046,
2127+
psk: 'secret',
2128+
version: 5,
2129+
'shadow-tls-password': 'shadow-pass',
2130+
'shadow-tls-sni': 'mask.example.com',
2131+
'shadow-tls-version': 3,
2132+
},
2133+
{
2134+
type: 'snell',
2135+
name: 'Egern Snell ShadowTLS Plugin',
2136+
server: 'snell-plugin.example.com',
2137+
port: 44046,
2138+
psk: 'secret',
2139+
version: 4,
2140+
plugin: 'shadow-tls',
2141+
'plugin-opts': {
2142+
host: 'mask.example.com',
2143+
password: 'shadow-pass',
2144+
version: 3,
2145+
},
2146+
},
2147+
{
2148+
type: 'snell',
2149+
name: 'Egern Snell Plain',
2150+
server: 'snell.example.com',
2151+
port: 44046,
2152+
psk: 'secret',
2153+
version: 5,
2154+
},
2155+
];
2156+
2157+
const { result: internal, errors } = captureErrors(() =>
2158+
produceInternal('Egern', proxies),
2159+
);
2160+
const { result: external, errors: externalErrors } = captureErrors(() =>
2161+
loadProducedYaml('Egern', proxies),
2162+
);
2163+
2164+
expect(errors).to.deep.equal([
2165+
'Platform Egern does not support Snell shadow-tls proxy Egern Snell ShadowTLS Fields. Proxy has been filtered.',
2166+
'Platform Egern does not support Snell shadow-tls proxy Egern Snell ShadowTLS Plugin. Proxy has been filtered.',
2167+
]);
2168+
expect(externalErrors).to.deep.equal(errors);
2169+
2170+
for (const output of [internal, external.proxies]) {
2171+
expect(output).to.have.length(1);
2172+
expectSubset(output[0], {
2173+
snell: {
2174+
name: 'Egern Snell Plain',
2175+
server: 'snell.example.com',
2176+
version: 5,
2177+
},
2178+
});
2179+
}
2180+
});
2181+
21202182
it('emits Egern SOCKS5 over TLS and root REALITY options', function () {
21212183
const proxies = [
21222184
{

0 commit comments

Comments
 (0)