mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-29 16:01:38 +00:00
feat: Stash VLESS REALITY 支持各种 flow(未限制 一般常见的截断后能使用), 不支持非 TCP 以外的传输层
This commit is contained in:
3 files changed
+234
-5
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.21.68",
|
||||
"version": "2.21.69",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -45,10 +45,14 @@ export default function Stash_Producer() {
|
||||
'2022-blake3-aes-128-gcm',
|
||||
'2022-blake3-aes-256-gcm',
|
||||
].includes(proxy.cipher)) ||
|
||||
(proxy.type === 'snell' && proxy.version >= 4) ||
|
||||
(proxy.type === 'vless' &&
|
||||
proxy['reality-opts'] &&
|
||||
!['xtls-rprx-vision'].includes(proxy.flow))
|
||||
(proxy.type === 'snell' && proxy.version >= 4)
|
||||
) {
|
||||
return false;
|
||||
} else if (
|
||||
['vless'].includes(proxy.type) &&
|
||||
proxy['reality-opts'] &&
|
||||
proxy.network &&
|
||||
!['tcp'].includes(proxy.network)
|
||||
) {
|
||||
return false;
|
||||
} else if (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { expect } from 'chai';
|
||||
import { describe, it } from 'mocha';
|
||||
|
||||
import { ProxyUtils } from '@/core/proxy-utils';
|
||||
import {
|
||||
UUID,
|
||||
expectSubset,
|
||||
@@ -226,6 +227,230 @@ describe('Proxy structured producers', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('emits Stash VLESS TCP REALITY proxies without validating flow values', function () {
|
||||
const proxy = {
|
||||
type: 'vless',
|
||||
name: 'Stash Reality Custom Flow',
|
||||
server: 'vless.example.com',
|
||||
port: 443,
|
||||
uuid: UUID,
|
||||
tls: true,
|
||||
network: 'tcp',
|
||||
flow: 'xtls-rprx-unknown',
|
||||
sni: 'sni.example.com',
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
};
|
||||
|
||||
const internal = produceInternal('Stash', proxy);
|
||||
const external = loadProducedYaml('Stash', proxy);
|
||||
|
||||
expect(internal).to.have.length(1);
|
||||
expect(external.proxies).to.have.length(1);
|
||||
expectSubset(internal[0], {
|
||||
type: 'vless',
|
||||
name: 'Stash Reality Custom Flow',
|
||||
network: 'tcp',
|
||||
flow: 'xtls-rprx-unknown',
|
||||
servername: 'sni.example.com',
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
});
|
||||
expectSubset(external.proxies[0], {
|
||||
type: 'vless',
|
||||
name: 'Stash Reality Custom Flow',
|
||||
network: 'tcp',
|
||||
flow: 'xtls-rprx-unknown',
|
||||
servername: 'sni.example.com',
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('keeps default-tcp Stash VLESS REALITY proxies when network is omitted', function () {
|
||||
const proxy = {
|
||||
type: 'vless',
|
||||
name: 'Implicit TCP Reality',
|
||||
server: 'vless.example.com',
|
||||
port: 443,
|
||||
uuid: UUID,
|
||||
tls: true,
|
||||
sni: 'sni.example.com',
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
};
|
||||
|
||||
const internal = produceInternal('Stash', proxy);
|
||||
const external = loadProducedYaml('Stash', proxy);
|
||||
|
||||
expect(internal).to.have.length(1);
|
||||
expect(external.proxies).to.have.length(1);
|
||||
expectSubset(internal[0], {
|
||||
type: 'vless',
|
||||
name: 'Implicit TCP Reality',
|
||||
servername: 'sni.example.com',
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
});
|
||||
expect(external.proxies[0]).to.not.have.property('network');
|
||||
});
|
||||
|
||||
it('keeps Stash VLESS TCP REALITY proxies when URI input omits flow', function () {
|
||||
const proxies = ProxyUtils.parse(
|
||||
`vless://${UUID}@vless.example.com:443?type=tcp&security=reality&sni=sni.example.com&pbk=pubkey&sid=08#No%20Flow`,
|
||||
);
|
||||
|
||||
const internal = produceInternal('Stash', proxies);
|
||||
const external = loadProducedYaml('Stash', proxies);
|
||||
|
||||
expect(internal).to.have.length(1);
|
||||
expect(external.proxies).to.have.length(1);
|
||||
expect(internal[0]).to.not.have.property('flow');
|
||||
expectSubset(internal[0], {
|
||||
type: 'vless',
|
||||
name: 'No Flow',
|
||||
network: 'tcp',
|
||||
servername: 'sni.example.com',
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
});
|
||||
expectSubset(external.proxies[0], {
|
||||
type: 'vless',
|
||||
name: 'No Flow',
|
||||
network: 'tcp',
|
||||
servername: 'sni.example.com',
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('keeps Stash VLESS TCP REALITY nodes while still filtering non-tcp and unsupported variants', function () {
|
||||
const proxies = [
|
||||
{
|
||||
type: 'vless',
|
||||
name: 'Supported Reality',
|
||||
server: 'vless.example.com',
|
||||
port: 443,
|
||||
uuid: UUID,
|
||||
tls: true,
|
||||
network: 'tcp',
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'vless',
|
||||
name: 'Custom Flow',
|
||||
server: 'unsupported-flow.example.com',
|
||||
port: 443,
|
||||
uuid: UUID,
|
||||
tls: true,
|
||||
network: 'tcp',
|
||||
flow: 'xtls-rprx-unknown',
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'vless',
|
||||
name: 'Reality WS',
|
||||
server: 'vless-ws.example.com',
|
||||
port: 443,
|
||||
uuid: UUID,
|
||||
tls: true,
|
||||
network: 'ws',
|
||||
'ws-opts': {
|
||||
path: '/ws',
|
||||
headers: {
|
||||
Host: 'cdn.example.com',
|
||||
},
|
||||
},
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'vless',
|
||||
name: 'XHTTP',
|
||||
server: 'vless-xhttp.example.com',
|
||||
port: 443,
|
||||
uuid: UUID,
|
||||
tls: true,
|
||||
network: 'xhttp',
|
||||
'xhttp-opts': {
|
||||
path: '/xhttp',
|
||||
},
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'vless',
|
||||
name: 'Encrypted VLESS',
|
||||
server: 'encrypted.example.com',
|
||||
port: 443,
|
||||
uuid: UUID,
|
||||
tls: true,
|
||||
network: 'tcp',
|
||||
encryption: 'aes-128-gcm',
|
||||
'reality-opts': {
|
||||
'public-key': 'pubkey',
|
||||
'short-id': '08',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const internal = produceInternal('Stash', proxies);
|
||||
const external = loadProducedYaml('Stash', proxies);
|
||||
|
||||
expect(internal).to.have.length(2);
|
||||
expect(external.proxies).to.have.length(2);
|
||||
expect(internal.map((proxy) => proxy.name)).to.deep.equal([
|
||||
'Supported Reality',
|
||||
'Custom Flow',
|
||||
]);
|
||||
expect(external.proxies.map((proxy) => proxy.name)).to.deep.equal([
|
||||
'Supported Reality',
|
||||
'Custom Flow',
|
||||
]);
|
||||
expectSubset(internal[0], {
|
||||
type: 'vless',
|
||||
name: 'Supported Reality',
|
||||
});
|
||||
expectSubset(internal[1], {
|
||||
type: 'vless',
|
||||
name: 'Custom Flow',
|
||||
flow: 'xtls-rprx-unknown',
|
||||
});
|
||||
expectSubset(external.proxies[0], {
|
||||
type: 'vless',
|
||||
name: 'Supported Reality',
|
||||
});
|
||||
expectSubset(external.proxies[1], {
|
||||
type: 'vless',
|
||||
name: 'Custom Flow',
|
||||
flow: 'xtls-rprx-unknown',
|
||||
});
|
||||
});
|
||||
|
||||
it('promotes shadow-tls fields for Shadowrocket', function () {
|
||||
const proxy = {
|
||||
type: 'ss',
|
||||
|
||||
Reference in new issue
Block a user