mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-28 15:33:47 +00:00
feat: QX tls-verification 支持非布尔值, 逻辑为 name-cert-verify
This commit is contained in:
5 files changed
+49
-31
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.36.15",
|
||||
"version": "2.36.16",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
|
||||
"main": "src/main.js",
|
||||
"packageManager": "pnpm@11.0.9",
|
||||
|
||||
@@ -187,8 +187,13 @@ fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
|
||||
|
||||
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
|
||||
tls_host = comma sni:("tls-host") equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||||
tls_verification = comma "tls-verification" equals flag:bool {
|
||||
proxy["skip-cert-verify"] = !flag;
|
||||
tls_verification = comma "tls-verification" equals raw:$[^,]+ {
|
||||
const value = raw.trim();
|
||||
if (value === "true" || value === "false") {
|
||||
proxy["skip-cert-verify"] = value !== "true";
|
||||
} else {
|
||||
proxy["name-cert-verify"] = value;
|
||||
}
|
||||
}
|
||||
tls_fingerprint = comma "tls-cert-sha256" equals tls_fingerprint:$[^,]+ { proxy["tls-fingerprint"] = tls_fingerprint.trim(); }
|
||||
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals param:$[^=,]+ { proxy["tls-pubkey-sha256"] = param; }
|
||||
|
||||
@@ -67,6 +67,18 @@ function getQxHttpObfs(proxy) {
|
||||
: 'http';
|
||||
}
|
||||
|
||||
function appendTlsVerification(result, proxy) {
|
||||
const attr = isPresent(proxy, 'name-cert-verify')
|
||||
? 'name-cert-verify'
|
||||
: 'skip-cert-verify';
|
||||
result.appendIfPresent(
|
||||
`,tls-verification=${
|
||||
proxy['name-cert-verify'] ?? !proxy['skip-cert-verify']
|
||||
}`,
|
||||
attr,
|
||||
);
|
||||
}
|
||||
|
||||
function shadowsocks(proxy) {
|
||||
const result = new Result(proxy);
|
||||
const append = result.append.bind(result);
|
||||
@@ -170,10 +182,7 @@ function shadowsocks(proxy) {
|
||||
);
|
||||
|
||||
// tls verification
|
||||
appendIfPresent(
|
||||
`,tls-verification=${!proxy['skip-cert-verify']}`,
|
||||
'skip-cert-verify',
|
||||
);
|
||||
appendTlsVerification(result, proxy);
|
||||
if (!isSSOverTls) {
|
||||
appendIfPresent(`,tls-host=${proxy.sni}`, 'sni');
|
||||
}
|
||||
@@ -301,10 +310,7 @@ function trojan(proxy) {
|
||||
);
|
||||
|
||||
// tls verification
|
||||
appendIfPresent(
|
||||
`,tls-verification=${!proxy['skip-cert-verify']}`,
|
||||
'skip-cert-verify',
|
||||
);
|
||||
appendTlsVerification(result, proxy);
|
||||
appendIfPresent(`,tls-host=${proxy.sni}`, 'sni');
|
||||
}
|
||||
|
||||
@@ -395,10 +401,7 @@ function vmess(proxy) {
|
||||
);
|
||||
|
||||
// tls verification
|
||||
appendIfPresent(
|
||||
`,tls-verification=${!proxy['skip-cert-verify']}`,
|
||||
'skip-cert-verify',
|
||||
);
|
||||
appendTlsVerification(result, proxy);
|
||||
appendIfPresent(`,tls-host=${proxy.sni}`, 'sni');
|
||||
}
|
||||
|
||||
@@ -501,10 +504,7 @@ function vless(proxy) {
|
||||
);
|
||||
|
||||
// tls verification
|
||||
appendIfPresent(
|
||||
`,tls-verification=${!proxy['skip-cert-verify']}`,
|
||||
'skip-cert-verify',
|
||||
);
|
||||
appendTlsVerification(result, proxy);
|
||||
appendIfPresent(`,tls-host=${proxy.sni}`, 'sni');
|
||||
}
|
||||
|
||||
@@ -563,10 +563,7 @@ function anytls(proxy) {
|
||||
`,tls-cert-sha256=${proxy['tls-fingerprint']}`,
|
||||
'tls-fingerprint',
|
||||
);
|
||||
appendIfPresent(
|
||||
`,tls-verification=${!proxy['skip-cert-verify']}`,
|
||||
'skip-cert-verify',
|
||||
);
|
||||
appendTlsVerification(result, proxy);
|
||||
appendIfPresent(`,tls-host=${proxy.sni}`, 'sni');
|
||||
|
||||
appendIfPresent(`,fast-open=${proxy.tfo}`, 'tfo');
|
||||
@@ -618,10 +615,7 @@ function http(proxy) {
|
||||
);
|
||||
|
||||
// tls verification
|
||||
appendIfPresent(
|
||||
`,tls-verification=${!proxy['skip-cert-verify']}`,
|
||||
'skip-cert-verify',
|
||||
);
|
||||
appendTlsVerification(result, proxy);
|
||||
appendIfPresent(`,tls-host=${proxy.sni}`, 'sni');
|
||||
}
|
||||
|
||||
@@ -679,10 +673,7 @@ function socks5(proxy) {
|
||||
);
|
||||
|
||||
// tls verification
|
||||
appendIfPresent(
|
||||
`,tls-verification=${!proxy['skip-cert-verify']}`,
|
||||
'skip-cert-verify',
|
||||
);
|
||||
appendTlsVerification(result, proxy);
|
||||
appendIfPresent(`,tls-host=${proxy.sni}`, 'sni');
|
||||
}
|
||||
|
||||
|
||||
@@ -2473,6 +2473,13 @@ describe('Platform raw-format parser coverage', function () {
|
||||
'skip-cert-verify': false,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'parses non-boolean tls-verification as name-cert-verify',
|
||||
input: `vless=qx-vless-verify-name.example.com:443,method=none,password=${UUID},obfs=wss,tls-verification=true.example.com,tag=QX VLESS Verify Name`,
|
||||
expected: {
|
||||
'name-cert-verify': 'true.example.com',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'parses shadowsocks over-tls lines without obfs-host',
|
||||
input: 'shadowsocks=qx-ss-tls-no-host.example.com:443,method=aes-128-gcm,password=secret,obfs=over-tls,udp-relay=true,tag=QX SS Over TLS No Host',
|
||||
|
||||
@@ -32,6 +32,21 @@ function captureErrors(fn) {
|
||||
}
|
||||
|
||||
describe('Proxy text producers', function () {
|
||||
it('uses name-cert-verify as Quantumult X tls-verification', function () {
|
||||
const output = produceExternal('QX', {
|
||||
type: 'vless',
|
||||
name: 'VLESS',
|
||||
server: 'vless.example.com',
|
||||
port: 443,
|
||||
uuid: UUID,
|
||||
tls: true,
|
||||
'skip-cert-verify': true,
|
||||
'name-cert-verify': 'verify.example.com',
|
||||
});
|
||||
|
||||
expect(output).to.include('tls-verification=verify.example.com');
|
||||
});
|
||||
|
||||
it('produces Quantumult X shadowsocks over-tls lines from canonical tls nodes', function () {
|
||||
const output = produceExternal('QX', {
|
||||
type: 'ss',
|
||||
|
||||
Reference in new issue
Block a user