Skip to content

Commit

Permalink
Merge pull request #229 from xream/feature/tuic
Browse files Browse the repository at this point in the history
Adjust the logic for determining the tuic version
  • Loading branch information
xream committed Aug 13, 2023
2 parents b770578 + 537a00e commit cb21a8e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
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.5",
"version": "2.14.6",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions backend/src/core/proxy-utils/producers/stash.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export default function Stash_Producer() {
} else {
proxy.alpn = ['h3'];
}
// https://github.com/MetaCubeX/Clash.Meta/blob/Alpha/adapter/outbound/tuic.go#L197
if (
(!proxy.token || proxy.token.length === 0) &&
!isPresent(proxy, 'version')
) {
proxy.version = 5;
}
}

delete proxy['tls-fingerprint'];
Expand Down
3 changes: 2 additions & 1 deletion backend/src/core/proxy-utils/producers/surge.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ function snell(proxy) {

function tuic(proxy) {
const result = new Result(proxy);
// https://github.com/MetaCubeX/Clash.Meta/blob/Alpha/adapter/outbound/tuic.go#L197
let type = proxy.type;
if (proxy.password && proxy.uuid) {
if (!proxy.token || proxy.token.length === 0) {
type = 'tuic-v5';
}
result.append(`${proxy.name}=${type},${proxy.server},${proxy.port}`);
Expand Down

0 comments on commit cb21a8e

Please sign in to comment.