fix: 修复 QX 无传输层时的 sni 逻辑

This commit is contained in:
xream committed 2026-04-13 01:23:55 +08:00
1 parent 2a760cee5c
commit 9799a579da
3 files changed
+45 -1

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.21.91",
"version": "2.21.92",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
@@ -39,6 +39,12 @@ const grammars = String.raw`
$set(proxy, "ws-opts.headers.Host", obfs.host);
} else if (obfs.type === "over-tls") {
proxy.tls = true;
// Some QX share links use obfs-host as the TLS server name for
// plain over-tls TCP nodes instead of the explicit tls-host field.
// Accept it as a compatibility alias, but do not override tls-host.
if (obfs.host && !proxy.sni) {
proxy.sni = obfs.host;
}
} else if (obfs.type === "http") {
proxy.network = "http";
$set(proxy, "http-opts.path", obfs.path);
@@ -1101,6 +1101,44 @@ describe('Platform raw-format parser coverage', function () {
},
},
},
{
title: 'parses vless over-tls lines using obfs-host as the tls server name alias',
input: `vless=qx-vless-overtls.example.com:37001,method=none,password=${UUID},obfs=over-tls,obfs-host=tls-name.example.com,tls13=true,tls-verification=false,reality-base64-pubkey=pubkey,reality-hex-shortid=01ab,vless-flow=xtls-rprx-vision,fast-open=false,udp-relay=true,tag=QX VLESS Over TLS Alias`,
expected: {
type: 'vless',
name: 'QX VLESS Over TLS Alias',
server: 'qx-vless-overtls.example.com',
port: 37001,
cipher: 'none',
uuid: UUID,
tls: true,
sni: 'tls-name.example.com',
'skip-cert-verify': true,
flow: 'xtls-rprx-vision',
udp: true,
tfo: false,
'reality-opts': {
'public-key': 'pubkey',
'short-id': '01ab',
},
},
},
{
title: 'prefers explicit tls-host over obfs-host for vless over-tls lines',
input: `vless=qx-vless-overtls-priority.example.com:443,method=none,password=${UUID},obfs=over-tls,obfs-host=tls-alias.example.com,tls-host=explicit-sni.example.com,tls-verification=false,vless-flow=xtls-rprx-vision,tag=QX VLESS Over TLS Explicit`,
expected: {
type: 'vless',
name: 'QX VLESS Over TLS Explicit',
server: 'qx-vless-overtls-priority.example.com',
port: 443,
cipher: 'none',
uuid: UUID,
tls: true,
sni: 'explicit-sni.example.com',
'skip-cert-verify': true,
flow: 'xtls-rprx-vision',
},
},
{
title: 'parses trojan websocket tls lines',
input: 'trojan=qx-trojan.example.com:443,password=secret,obfs=wss,obfs-host=cdn.example.com,obfs-uri=/trojan,tls-verification=false,tls-host=sni.example.com,tls-cert-sha256=fingerprint,tag=QX Trojan',