feat: Surge VLESS 新增 reality-mldsa65-verify
build / build (push) Waiting to run

This commit is contained in:
xream committed 2026-12-04 23:50:48 +08:00
1 parent 838bf242e8
commit 99bddddd5a
4 files changed
+30 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.44.39",
"version": "2.44.40",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"packageManager": "pnpm@11.0.9",
@@ -677,7 +677,9 @@ vmess_aead = comma "vmess-aead" equals flag:bool { proxy.aead = flag; }
// shortcut: keep text IDs as given, convert them to UUIDv5 when a target requires it.
vless_username = comma "username" equals value:quoted_value { proxy.uuid = value.trim(); }
vless_option = comma key:("flow"/"encryption") equals value:quoted_value { proxy[key] = value.trim(); }
reality_option = comma "reality-" key:("public-key"/"short-id") equals value:quoted_value { $set(proxy, "reality-opts." + key, value.trim()); }
reality_option
= comma "reality-mldsa65-verify" equals value:quoted_value { proxy._pqv = value.trim(); }
/ comma "reality-" key:("public-key"/"short-id") equals value:quoted_value { $set(proxy, "reality-opts." + key, value.trim()); }
client_random_auth_key = comma "client-random-auth-key" equals value:$[^,]* { proxy["client-random-auth-key"] = stripQuotes(value); }
method = comma "encrypt-method" equals cipher:cipher {
@@ -600,6 +600,16 @@ function appendVlessParams(result, proxy) {
if (reality['short-id']) {
result.append(`,reality-short-id=${reality['short-id']}`);
}
if (isNotBlank(proxy._pqv)) {
const verifyKey = proxy._pqv.trim();
// shortcut: validate serialization syntax only; decode if key validity is ever required here.
if (!/^[A-Za-z0-9+/_-]+={0,2}$/.test(verifyKey)) {
throw new Error(
'VLESS reality-mldsa65-verify must be base64 or base64url',
);
}
result.append(`,reality-mldsa65-verify=${verifyKey}`);
}
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
appendAlpn(result, proxy);
appendClientFingerprint(result, proxy);
@@ -4762,6 +4762,22 @@ describe('Proxy text producers', function () {
);
});
it('round-trips REALITY ML-DSA-65 keys between VLESS links and Surge', function () {
const link = `vless://${UUID}@192.0.2.1:443?security=reality&pbk=${'A'.repeat(43)}`;
for (const key of ['a+/8/38=', 'a-_8_38']) {
const pqv = `&pqv=${encodeURIComponent(key)}`;
const [proxy] = ProxyUtils.parse(`${link}${pqv}#RAW`);
for (const target of ['Surge', 'SurgeMac']) {
const output = produceExternal(target, proxy);
expect(output).to.include(`,reality-mldsa65-verify=${key}`);
const [reparsed] = ProxyUtils.parse(output);
expect(reparsed._pqv).to.equal(key);
expect(produceExternal('URI', reparsed)).to.include(pqv);
}
}
});
it('round-trips Surge VLESS XHTTP modes', function () {
const prefix = `XHTTP=vless,example.com,443,username=${UUID},xhttp=true,xhttp-path=/path,xhttp-host=cdn.example.com`;
for (const mode of [