Skip to content

Commit 28d5232

Browse files
committed
fix: keep Shadowrocket TLS fingerprint default
1 parent 0647782 commit 28d5232

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

packages/core/src/parser/protocols/vless.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ describe("parseVLESS", () => {
110110
uuid: UUID,
111111
tls: true,
112112
flow: "xtls-rprx-vision",
113+
"client-fingerprint": "chrome",
113114
network: "ws",
114115
"ws-opts": {
115116
path: "/ws",
@@ -119,14 +120,14 @@ describe("parseVLESS", () => {
119120
},
120121
});
121122
expect(node).not.toHaveProperty("reality-opts");
122-
expect(node).not.toHaveProperty("client-fingerprint");
123123

124124
const encodedWithoutPrefix = Buffer.from(`${UUID}@shadow-simple.example.com:443`).toString("base64url");
125125
expect(parseVLESS(`vless://${encodedWithoutPrefix}?obfs=websocket&tls=1&xtls=1&tls-verification=false&remark=SimpleSR`)).toMatchObject({
126126
name: "SimpleSR",
127127
server: "shadow-simple.example.com",
128128
uuid: UUID,
129129
flow: "xtls-rprx-direct",
130+
"client-fingerprint": "chrome",
130131
"skip-cert-verify": true,
131132
network: "ws",
132133
});
@@ -162,6 +163,7 @@ describe("parseVLESS", () => {
162163
uuid: UUID,
163164
tls: true,
164165
servername: "front.example.com",
166+
"client-fingerprint": "chrome",
165167
network: "xhttp",
166168
"xhttp-opts": {
167169
path: "/xhttp",
@@ -253,6 +255,7 @@ describe("parseVLESS", () => {
253255
},
254256
});
255257
expect(explicitTls).not.toHaveProperty("reality-opts");
258+
expect(explicitTls).not.toHaveProperty("client-fingerprint");
256259
});
257260

258261
it("parses TCP, H2, HTTP Upgrade, and Reality detail variants", () => {

packages/core/src/parser/protocols/vless.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,14 @@ export function parseVLESS(uri: string): VLESSNode {
264264
})();
265265
const pbk = pickQueryValue(params, ["pbk", "public-key", "public_key", "publicKey"]);
266266
const explicitSecurity = (params.get("security") || "").trim().toLowerCase();
267+
const usesImplicitShadowrocketTls =
268+
!explicitSecurity &&
269+
!pbk &&
270+
normalized.isShadowrocket &&
271+
parseBoolish(params.get("tls")) === true;
267272
const security =
268273
explicitSecurity ||
269-
(pbk ? "reality" : normalized.isShadowrocket && parseBoolish(params.get("tls")) ? "tls" : "none");
274+
(pbk ? "reality" : usesImplicitShadowrocketTls ? "tls" : "none");
270275
const flow = (() => {
271276
const direct = params.get("flow") || "";
272277
if (direct.trim()) return direct.trim();
@@ -334,6 +339,7 @@ export function parseVLESS(uri: string): VLESSNode {
334339
if (list && list.length > 0) node.alpn = list;
335340
}
336341
if (clientFingerprint) node["client-fingerprint"] = clientFingerprint;
342+
else if (usesImplicitShadowrocketTls) node["client-fingerprint"] = "chrome";
337343

338344
if (params.get("pcs")) {
339345
(node as unknown as Record<string, unknown>).pcs = params.get("pcs");

0 commit comments

Comments
 (0)