From 96769598ef43da5ab22697217620a48ec6750292 Mon Sep 17 00:00:00 2001 From: xream Date: Tue, 22 Aug 2023 00:42:53 +0800 Subject: [PATCH] fix: QX tls --- backend/package.json | 2 +- backend/src/core/proxy-utils/producers/qx.js | 120 ++++++++++--------- 2 files changed, 66 insertions(+), 56 deletions(-) diff --git a/backend/package.json b/backend/package.json index bccd2c2..103f691 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.16", + "version": "2.14.17", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/producers/qx.js b/backend/src/core/proxy-utils/producers/qx.js index c5091bb..b924333 100644 --- a/backend/src/core/proxy-utils/producers/qx.js +++ b/backend/src/core/proxy-utils/producers/qx.js @@ -62,18 +62,20 @@ function shadowsocks(proxy) { ); } - // tls fingerprint - appendIfPresent( - `,tls-cert-sha256=${proxy['tls-fingerprint']}`, - 'tls-fingerprint', - ); + if (needTls(proxy)) { + // tls fingerprint + appendIfPresent( + `,tls-cert-sha256=${proxy['tls-fingerprint']}`, + 'tls-fingerprint', + ); - // tls verification - appendIfPresent( - `,tls-verification=${!proxy['skip-cert-verify']}`, - 'skip-cert-verify', - ); - appendIfPresent(`,tls-host=${proxy.sni}`, 'sni'); + // tls verification + appendIfPresent( + `,tls-verification=${!proxy['skip-cert-verify']}`, + 'skip-cert-verify', + ); + appendIfPresent(`,tls-host=${proxy.sni}`, 'sni'); + } // tfo appendIfPresent(`,fast-open=${proxy.tfo}`, 'tfo'); @@ -150,18 +152,20 @@ function trojan(proxy) { append(`,over-tls=true`); } - // tls fingerprint - appendIfPresent( - `,tls-cert-sha256=${proxy['tls-fingerprint']}`, - 'tls-fingerprint', - ); + if (needTls(proxy)) { + // tls fingerprint + appendIfPresent( + `,tls-cert-sha256=${proxy['tls-fingerprint']}`, + 'tls-fingerprint', + ); - // tls verification - appendIfPresent( - `,tls-verification=${!proxy['skip-cert-verify']}`, - 'skip-cert-verify', - ); - appendIfPresent(`,tls-host=${proxy.sni}`, 'sni'); + // tls verification + appendIfPresent( + `,tls-verification=${!proxy['skip-cert-verify']}`, + 'skip-cert-verify', + ); + appendIfPresent(`,tls-host=${proxy.sni}`, 'sni'); + } // tfo appendIfPresent(`,fast-open=${proxy.tfo}`, 'tfo'); @@ -221,18 +225,20 @@ function vmess(proxy) { if (proxy.tls) append(`,obfs=over-tls`); } - // tls fingerprint - appendIfPresent( - `,tls-cert-sha256=${proxy['tls-fingerprint']}`, - 'tls-fingerprint', - ); + if (needTls(proxy)) { + // tls fingerprint + appendIfPresent( + `,tls-cert-sha256=${proxy['tls-fingerprint']}`, + 'tls-fingerprint', + ); - // tls verification - appendIfPresent( - `,tls-verification=${!proxy['skip-cert-verify']}`, - 'skip-cert-verify', - ); - appendIfPresent(`,tls-host=${proxy.sni}`, 'sni'); + // tls verification + appendIfPresent( + `,tls-verification=${!proxy['skip-cert-verify']}`, + 'skip-cert-verify', + ); + appendIfPresent(`,tls-host=${proxy.sni}`, 'sni'); + } // AEAD if (isPresent(proxy, 'aead')) { @@ -268,18 +274,20 @@ function http(proxy) { } appendIfPresent(`,over-tls=${proxy.tls}`, 'tls'); - // tls fingerprint - appendIfPresent( - `,tls-cert-sha256=${proxy['tls-fingerprint']}`, - 'tls-fingerprint', - ); + if (needTls(proxy)) { + // tls fingerprint + appendIfPresent( + `,tls-cert-sha256=${proxy['tls-fingerprint']}`, + 'tls-fingerprint', + ); - // tls verification - appendIfPresent( - `,tls-verification=${!proxy['skip-cert-verify']}`, - 'skip-cert-verify', - ); - appendIfPresent(`,tls-host=${proxy.sni}`, 'sni'); + // tls verification + appendIfPresent( + `,tls-verification=${!proxy['skip-cert-verify']}`, + 'skip-cert-verify', + ); + appendIfPresent(`,tls-host=${proxy.sni}`, 'sni'); + } // tfo appendIfPresent(`,fast-open=${proxy.tfo}`, 'tfo'); @@ -308,18 +316,20 @@ function socks5(proxy) { } appendIfPresent(`,over-tls=${proxy.tls}`, 'tls'); - // tls fingerprint - appendIfPresent( - `,tls-cert-sha256=${proxy['tls-fingerprint']}`, - 'tls-fingerprint', - ); + if (needTls(proxy)) { + // tls fingerprint + appendIfPresent( + `,tls-cert-sha256=${proxy['tls-fingerprint']}`, + 'tls-fingerprint', + ); - // tls verification - appendIfPresent( - `,tls-verification=${!proxy['skip-cert-verify']}`, - 'skip-cert-verify', - ); - appendIfPresent(`,tls-host=${proxy.sni}`, 'sni'); + // tls verification + appendIfPresent( + `,tls-verification=${!proxy['skip-cert-verify']}`, + 'skip-cert-verify', + ); + appendIfPresent(`,tls-host=${proxy.sni}`, 'sni'); + } // tfo appendIfPresent(`,fast-open=${proxy.tfo}`, 'tfo');