From baec193e5cae2632011402c0358e29e943399e68 Mon Sep 17 00:00:00 2001 From: xream Date: Wed, 23 Oct 2024 17:38:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20VLESS=20mKcp?= 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 | 8 ++++++++ backend/src/core/proxy-utils/producers/uri.js | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index 58e506115..5a1084308 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.402", + "version": "2.14.403", "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 8dc32744c..f82fa9163 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -531,6 +531,14 @@ function URI_VLESS() { if (Object.keys(opts).length > 0) { proxy[`${proxy.network}-opts`] = opts; } + if (proxy.network === 'kcp') { + // mKCP 种子。省略时不使用种子,但不可以为空字符串。建议 mKCP 用户使用 seed。 + if (params.seed) { + proxy.seed = params.seed; + } + // mKCP 的伪装头部类型。当前可选值有 none / srtp / utp / wechat-video / dtls / wireguard。省略时默认值为 none,即不使用伪装头部,但不可以为空字符串。 + proxy.headerType = params.headerType || 'none'; + } } return proxy; diff --git a/backend/src/core/proxy-utils/producers/uri.js b/backend/src/core/proxy-utils/producers/uri.js index d5be0c493..13135015c 100644 --- a/backend/src/core/proxy-utils/producers/uri.js +++ b/backend/src/core/proxy-utils/producers/uri.js @@ -224,6 +224,18 @@ export default function URI_Producer() { vlessTransportServiceName, )}`; } + if (proxy.network === 'kcp') { + if (proxy.seed) { + vlessTransport += `&seed=${encodeURIComponent( + proxy.seed, + )}`; + } + if (proxy.headerType) { + vlessTransport += `&headerType=${encodeURIComponent( + proxy.headerType, + )}`; + } + } result = `vless://${proxy.uuid}@${proxy.server}:${ proxy.port