Skip to content

Commit

Permalink
feat: 支持 VLESS mKcp
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Oct 23, 2024
1 parent 8fe818f commit baec193
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
8 changes: 8 additions & 0 deletions backend/src/core/proxy-utils/parsers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions backend/src/core/proxy-utils/producers/uri.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit baec193

Please sign in to comment.