From 0f84a601cd08503dc962a982c3342216db9dbba6 Mon Sep 17 00:00:00 2001 From: xream Date: Wed, 10 Jun 2026 13:30:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Egern=20=E8=BF=87=E6=BB=A4=E5=B8=A6=20S?= =?UTF-8?q?hadowTLS=20=E7=9A=84=20Snell=20=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- .../src/core/proxy-utils/producers/egern.js | 14 +++++ .../test/proxy-producers/structured.spec.js | 62 +++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index 0a6f3eda..7f0f6662 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.24.12", + "version": "2.24.13", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "packageManager": "pnpm@11.0.9", diff --git a/backend/src/core/proxy-utils/producers/egern.js b/backend/src/core/proxy-utils/producers/egern.js index 46d3c04a..02235f53 100644 --- a/backend/src/core/proxy-utils/producers/egern.js +++ b/backend/src/core/proxy-utils/producers/egern.js @@ -92,6 +92,11 @@ export default function Egern_Producer() { normalizeSnellVersion(proxy.version) === null ) { return false; + } else if (proxy.type === 'snell' && hasShadowTls(proxy)) { + $.error( + `Platform Egern does not support Snell shadow-tls proxy ${proxy.name}. Proxy has been filtered.`, + ); + return false; } else if ( ['anytls'].includes(proxy.type) && proxy.network && @@ -687,6 +692,15 @@ function getUdpRelay(proxy) { return proxy.udp ?? proxy.udp_relay; } +function hasShadowTls(proxy) { + return ( + proxy.plugin === 'shadow-tls' || + isPresent(proxy, 'shadow-tls-password') || + isPresent(proxy, 'shadow-tls-sni') || + isPresent(proxy, 'shadow-tls-version') + ); +} + function getNonEmptyValue(value) { if (value == null) return undefined; if (typeof value === 'string' && value.length === 0) return undefined; diff --git a/backend/src/test/proxy-producers/structured.spec.js b/backend/src/test/proxy-producers/structured.spec.js index ad09377c..0fa114a7 100644 --- a/backend/src/test/proxy-producers/structured.spec.js +++ b/backend/src/test/proxy-producers/structured.spec.js @@ -2117,6 +2117,68 @@ describe('Proxy structured producers', function () { } }); + it('filters Egern Snell shadow-tls variants', function () { + const proxies = [ + { + type: 'snell', + name: 'Egern Snell ShadowTLS Fields', + server: 'snell-shadowtls.example.com', + port: 44046, + psk: 'secret', + version: 5, + 'shadow-tls-password': 'shadow-pass', + 'shadow-tls-sni': 'mask.example.com', + 'shadow-tls-version': 3, + }, + { + type: 'snell', + name: 'Egern Snell ShadowTLS Plugin', + server: 'snell-plugin.example.com', + port: 44046, + psk: 'secret', + version: 4, + plugin: 'shadow-tls', + 'plugin-opts': { + host: 'mask.example.com', + password: 'shadow-pass', + version: 3, + }, + }, + { + type: 'snell', + name: 'Egern Snell Plain', + server: 'snell.example.com', + port: 44046, + psk: 'secret', + version: 5, + }, + ]; + + const { result: internal, errors } = captureErrors(() => + produceInternal('Egern', proxies), + ); + const { result: external, errors: externalErrors } = captureErrors(() => + loadProducedYaml('Egern', proxies), + ); + + expect(errors).to.deep.equal([ + 'Platform Egern does not support Snell shadow-tls proxy Egern Snell ShadowTLS Fields. Proxy has been filtered.', + 'Platform Egern does not support Snell shadow-tls proxy Egern Snell ShadowTLS Plugin. Proxy has been filtered.', + ]); + expect(externalErrors).to.deep.equal(errors); + + for (const output of [internal, external.proxies]) { + expect(output).to.have.length(1); + expectSubset(output[0], { + snell: { + name: 'Egern Snell Plain', + server: 'snell.example.com', + version: 5, + }, + }); + } + }); + it('emits Egern SOCKS5 over TLS and root REALITY options', function () { const proxies = [ {