mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-28 07:24:12 +00:00
feat: Egern 过滤带 ShadowTLS 的 Snell 节点
This commit is contained in:
3 files changed
+77
-1
No files matched your search
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 = [
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user