Skip to content

Commit dd8d1d8

Browse files
committed
feat: 支持 Loon tls-pubkey-sha256, tls-cert-sha256
1 parent 14ed56b commit dd8d1d8

File tree

4 files changed

+50
-13
lines changed

4 files changed

+50
-13
lines changed

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store",
3-
"version": "2.14.358",
3+
"version": "2.14.359",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
55
"main": "src/main.js",
66
"scripts": {

backend/src/core/proxy-utils/parsers/peggy/loon.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,31 @@ shadowsocks = tag equals "shadowsocks"i address method password (obfs_typev obfs
5454
$set(proxy, "plugin-opts.path", obfs.path);
5555
}
5656
}
57-
vmess = tag equals "vmess"i address method uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/vmess_alterId/fast_open/udp_relay/others)* {
57+
vmess = tag equals "vmess"i address method uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/vmess_alterId/fast_open/udp_relay/others)* {
5858
proxy.type = "vmess";
5959
proxy.cipher = proxy.cipher || "none";
6060
proxy.alterId = proxy.alterId || 0;
6161
handleTransport();
6262
}
63-
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/fast_open/udp_relay/others)* {
63+
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
6464
proxy.type = "vless";
6565
handleTransport();
6666
}
67-
trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/fast_open/udp_relay/others)* {
67+
trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
6868
proxy.type = "trojan";
6969
handleTransport();
7070
}
71-
hysteria2 = tag equals "hysteria2"i address password (tls_host/tls_verification/udp_relay/fast_open/download_bandwidth/salamander_password/ecn/others)* {
71+
hysteria2 = tag equals "hysteria2"i address password (tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/udp_relay/fast_open/download_bandwidth/salamander_password/ecn/others)* {
7272
proxy.type = "hysteria2";
7373
}
74-
https = tag equals "https"i address (username password)? (tls_host/tls_verification/fast_open/udp_relay/others)* {
74+
https = tag equals "https"i address (username password)? (tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
7575
proxy.type = "http";
7676
proxy.tls = true;
7777
}
7878
http = tag equals "http"i address (username password)? (fast_open/udp_relay/others)* {
7979
proxy.type = "http";
8080
}
81-
socks5 = tag equals "socks5"i address (username password)? (over_tls/tls_host/tls_verification/fast_open/udp_relay/others)* {
81+
socks5 = tag equals "socks5"i address (username password)? (over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
8282
proxy.type = "socks5";
8383
}
8484
@@ -172,6 +172,8 @@ vmess_alterId = comma "alterId" equals alterId:$[0-9]+ { proxy.alterId = parseIn
172172
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
173173
tls_host = comma sni:("tls-name"/"sni") equals host:domain { proxy.sni = host; }
174174
tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; }
175+
tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
176+
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); }
175177
176178
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
177179
udp_relay = comma "udp" equals flag:bool { proxy.udp = flag; }
@@ -180,6 +182,7 @@ ecn = comma "ecn" equals flag:bool { proxy.ecn = flag; }
180182
download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); }
181183
salamander_password = comma "salamander-password" equals match:[^,]+ { proxy['obfs-password'] = match.join(""); proxy.obfs = 'salamander'; }
182184
185+
183186
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
184187
comma = _ "," _
185188
equals = _ "=" _

backend/src/core/proxy-utils/parsers/peggy/loon.peg

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,31 @@ shadowsocks = tag equals "shadowsocks"i address method password (obfs_typev obfs
5252
$set(proxy, "plugin-opts.path", obfs.path);
5353
}
5454
}
55-
vmess = tag equals "vmess"i address method uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/vmess_alterId/fast_open/udp_relay/others)* {
55+
vmess = tag equals "vmess"i address method uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/vmess_alterId/fast_open/udp_relay/others)* {
5656
proxy.type = "vmess";
5757
proxy.cipher = proxy.cipher || "none";
5858
proxy.alterId = proxy.alterId || 0;
5959
handleTransport();
6060
}
61-
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/fast_open/udp_relay/others)* {
61+
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
6262
proxy.type = "vless";
6363
handleTransport();
6464
}
65-
trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/fast_open/udp_relay/others)* {
65+
trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
6666
proxy.type = "trojan";
6767
handleTransport();
6868
}
69-
hysteria2 = tag equals "hysteria2"i address password (tls_host/tls_verification/udp_relay/fast_open/download_bandwidth/salamander_password/ecn/others)* {
69+
hysteria2 = tag equals "hysteria2"i address password (tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/udp_relay/fast_open/download_bandwidth/salamander_password/ecn/others)* {
7070
proxy.type = "hysteria2";
7171
}
72-
https = tag equals "https"i address (username password)? (tls_host/tls_verification/fast_open/udp_relay/others)* {
72+
https = tag equals "https"i address (username password)? (tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
7373
proxy.type = "http";
7474
proxy.tls = true;
7575
}
7676
http = tag equals "http"i address (username password)? (fast_open/udp_relay/others)* {
7777
proxy.type = "http";
7878
}
79-
socks5 = tag equals "socks5"i address (username password)? (over_tls/tls_host/tls_verification/fast_open/udp_relay/others)* {
79+
socks5 = tag equals "socks5"i address (username password)? (over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/others)* {
8080
proxy.type = "socks5";
8181
}
8282

@@ -170,6 +170,8 @@ vmess_alterId = comma "alterId" equals alterId:$[0-9]+ { proxy.alterId = parseIn
170170
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
171171
tls_host = comma sni:("tls-name"/"sni") equals host:domain { proxy.sni = host; }
172172
tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; }
173+
tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
174+
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); }
173175

174176
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
175177
udp_relay = comma "udp" equals flag:bool { proxy.udp = flag; }

backend/src/core/proxy-utils/producers/loon.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ function trojan(proxy) {
153153

154154
// sni
155155
result.appendIfPresent(`,tls-name=${proxy.sni}`, 'sni');
156+
result.appendIfPresent(
157+
`,tls-cert-sha256=${proxy['tls-fingerprint']}`,
158+
'tls-fingerprint',
159+
);
160+
result.appendIfPresent(
161+
`,tls-pubkey-sha256=${proxy['tls-pubkey-sha256']}`,
162+
'tls-pubkey-sha256',
163+
);
156164

157165
// tfo
158166
result.appendIfPresent(`,fast-open=${proxy.tfo}`, 'tfo');
@@ -215,6 +223,14 @@ function vmess(proxy) {
215223

216224
// sni
217225
result.appendIfPresent(`,tls-name=${proxy.sni}`, 'sni');
226+
result.appendIfPresent(
227+
`,tls-cert-sha256=${proxy['tls-fingerprint']}`,
228+
'tls-fingerprint',
229+
);
230+
result.appendIfPresent(
231+
`,tls-pubkey-sha256=${proxy['tls-pubkey-sha256']}`,
232+
'tls-pubkey-sha256',
233+
);
218234

219235
// AEAD
220236
if (isPresent(proxy, 'aead')) {
@@ -286,6 +302,14 @@ function vless(proxy) {
286302

287303
// sni
288304
result.appendIfPresent(`,tls-name=${proxy.sni}`, 'sni');
305+
result.appendIfPresent(
306+
`,tls-cert-sha256=${proxy['tls-fingerprint']}`,
307+
'tls-fingerprint',
308+
);
309+
result.appendIfPresent(
310+
`,tls-pubkey-sha256=${proxy['tls-pubkey-sha256']}`,
311+
'tls-pubkey-sha256',
312+
);
289313

290314
// tfo
291315
result.appendIfPresent(`,fast-open=${proxy.tfo}`, 'tfo');
@@ -418,6 +442,14 @@ function hysteria2(proxy) {
418442

419443
// sni
420444
result.appendIfPresent(`,tls-name=${proxy.sni}`, 'sni');
445+
result.appendIfPresent(
446+
`,tls-cert-sha256=${proxy['tls-fingerprint']}`,
447+
'tls-fingerprint',
448+
);
449+
result.appendIfPresent(
450+
`,tls-pubkey-sha256=${proxy['tls-pubkey-sha256']}`,
451+
'tls-pubkey-sha256',
452+
);
421453
result.appendIfPresent(
422454
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
423455
'skip-cert-verify',

0 commit comments

Comments
 (0)