From 4ef4431c2c60b27ecc0564a17f2f636776db9c1e Mon Sep 17 00:00:00 2001 From: xream Date: Fri, 14 Feb 2025 23:27:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B9=E6=9B=B4=E5=A4=9A=20?= =?UTF-8?q?TUIC=20URI=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/core/proxy-utils/parsers/index.js | 10 ++++++---- backend/src/core/proxy-utils/producers/uri.js | 7 +++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/backend/package.json b/backend/package.json index d947dde..fab2198 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.16.41", + "version": "2.16.42", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/parsers/index.js b/backend/src/core/proxy-utils/parsers/index.js index 1751e9b..9bd87d4 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -869,12 +869,14 @@ function URI_TUIC() { value = decodeURIComponent(value); if (['alpn'].includes(key)) { proxy[key] = value ? value.split(',') : undefined; - } else if (['allow-insecure'].includes(key)) { + } else if (['allow_insecure'].includes(key)) { proxy['skip-cert-verify'] = /(TRUE)|1/i.test(value); - } else if (['disable-sni', 'reduce-rtt'].includes(key)) { - proxy[key] = /(TRUE)|1/i.test(value); + } else if (['fast_open'].includes(key)) { + proxy.tfo = true; + } else if (['disable_sni', 'reduce_rtt'].includes(key)) { + proxy[key.replace(/_/g, '-')] = /(TRUE)|1/i.test(value); } else { - proxy[key] = value; + proxy[key.replace(/_/g, '-')] = value; } } diff --git a/backend/src/core/proxy-utils/producers/uri.js b/backend/src/core/proxy-utils/producers/uri.js index edcbc2b..caf8ec3 100644 --- a/backend/src/core/proxy-utils/producers/uri.js +++ b/backend/src/core/proxy-utils/producers/uri.js @@ -521,10 +521,13 @@ export default function URI_Producer() { ['disable-sni', 'reduce-rtt'].includes(key) && proxy[key] ) { - tuicParams.push(`${i}=1`); + tuicParams.push(`${i.replace(/-/g, '_')}=1`); } else if (proxy[key]) { tuicParams.push( - `${i}=${encodeURIComponent(proxy[key])}`, + `${i.replace( + /-/g, + '_', + )}=${encodeURIComponent(proxy[key])}`, ); } }