mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-27 23:13:43 +00:00
feat: 未显式关闭 udp 的情况下, 视为开启 udp
This commit is contained in:
5 files changed
+23
-5
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.36.6",
|
||||
"version": "2.36.7",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
|
||||
"main": "src/main.js",
|
||||
"packageManager": "pnpm@11.0.9",
|
||||
|
||||
@@ -718,6 +718,9 @@ function formatTransportPath(path) {
|
||||
}
|
||||
|
||||
function lastParse(proxy) {
|
||||
proxy.udp = ![false, 0, '0', 'false', 'off'].includes(
|
||||
typeof proxy.udp === 'string' ? proxy.udp.toLowerCase() : proxy.udp,
|
||||
);
|
||||
if (typeof proxy.cipher === 'string') {
|
||||
proxy.cipher = proxy.cipher.toLowerCase();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('VMess and VLESS parser coverage', function () {
|
||||
port: 443,
|
||||
cipher: 'auto',
|
||||
uuid: UUID,
|
||||
udp: 'true',
|
||||
udp: true,
|
||||
tfo: 'true',
|
||||
'skip-cert-verify': false,
|
||||
});
|
||||
|
||||
@@ -107,6 +107,21 @@ describe('Proxy structured producers', function () {
|
||||
expect(output.proxies[0]).to.not.have.property('_loon_tls_profile');
|
||||
});
|
||||
|
||||
it('defaults omitted UDP to true while preserving explicit disablement', function () {
|
||||
const [enabled, disabled] = ProxyUtils.parse(
|
||||
'Surge AnyTLS=anytls,anytls.example.com,443,password=secret\nanytls=anytls.example.com:443,password=secret,udp-relay=false,tag=QX AnyTLS No UDP',
|
||||
);
|
||||
|
||||
expect(enabled.udp).to.equal(true);
|
||||
const output = loadProducedYaml('Mihomo', [enabled, disabled]).proxies;
|
||||
expect(
|
||||
output.find((proxy) => proxy.name === enabled.name).udp,
|
||||
).to.equal(true);
|
||||
expect(
|
||||
output.find((proxy) => proxy.name === disabled.name).udp,
|
||||
).to.equal(false);
|
||||
});
|
||||
|
||||
it('normalizes VMess security values for documented target platforms', function () {
|
||||
const invalidSecurityProxy = {
|
||||
type: 'vmess',
|
||||
|
||||
@@ -875,7 +875,7 @@ describe('Proxy text producers', function () {
|
||||
const output = produceExternal('Loon', proxy);
|
||||
|
||||
expect(output).to.equal(
|
||||
'URI Hysteria2=Hysteria2,hy2.example.com,443,"secret",server-ports="1000,2000-3000,5000",hop-interval=30,tls-name=hy2.example.com,skip-cert-verify=false,fast-open=false',
|
||||
'URI Hysteria2=Hysteria2,hy2.example.com,443,"secret",server-ports="1000,2000-3000,5000",hop-interval=30,tls-name=hy2.example.com,skip-cert-verify=false,fast-open=false,udp=true',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1385,8 +1385,8 @@ describe('Proxy text producers', function () {
|
||||
const output = ProxyUtils.produce(proxies, 'Surge', 'external');
|
||||
|
||||
expect(output.split('\n')).to.deep.equal([
|
||||
`Surge H2 Round Trip=h2-connect,h2.example.com,443,headers="X-Padding:"<random-string(16-32)>"",max-streams=1,sni="sni.example.com"`,
|
||||
`Surge Trust Round Trip=trust-tunnel,trust.example.com,443,username="user",password="pass",headers="X-Client:"Surge"",max-streams=3,sni="sni.example.com"`,
|
||||
`Surge H2 Round Trip=h2-connect,h2.example.com,443,headers="X-Padding:"<random-string(16-32)>"",max-streams=1,sni="sni.example.com",udp-relay=true`,
|
||||
`Surge Trust Round Trip=trust-tunnel,trust.example.com,443,username="user",password="pass",headers="X-Client:"Surge"",max-streams=3,sni="sni.example.com",udp-relay=true`,
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user