Skip to content

Commit 1171fdb

Browse files
author
bestrui
committed
feat: ✨ 同步 2.21.51
1 parent 0f9ee6c commit 1171fdb

10 files changed

Lines changed: 34 additions & 43 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ obfs_ss = comma "obfs-name" equals type:("http"/"tls") { obfs.type = type; }
160160
obfs_ssr = comma "obfs" equals type:("plain"/"http_simple"/"http_post"/"random_head"/"tls1.2_ticket_auth"/"tls1.2_ticket_fastauth") { obfs.type = type; }
161161
obfs_ssr_param = comma "obfs-param" equals match:$[^,]+ { proxy["obfs-param"] = match; }
162162
163-
obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; }
163+
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); }
164164
obfs_uri = comma "obfs-uri" equals uri:uri { obfs.path = uri; }
165165
uri = $[^,]+
166166
167167
transport = comma "transport" equals type:("tcp"/"ws"/"http") { transport.type = type; }
168-
transport_host = comma "host" equals host:domain { transport.host = host; }
168+
transport_host = comma "host" equals match:[^,]+ { transport.host = match.join("").replace(/^"(.*)"$/, '$1'); }
169169
transport_path = comma "path" equals path:uri { transport.path = path; }
170170
171171
ssr_protocol = comma "protocol" equals protocol:("origin"/"auth_sha1_v4"/"auth_aes128_md5"/"auth_aes128_sha1"/"auth_chain_a"/"auth_chain_b") { proxy.protocol = protocol; }
@@ -179,8 +179,8 @@ shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { proxy["shadow-tls-s
179179
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join(""); }
180180
181181
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
182-
tls_name = comma sni:("tls-name") equals host:domain { proxy.sni = host; }
183-
sni = comma sni:("sni") equals host:domain { proxy.sni = host; }
182+
tls_name = comma sni:("tls-name") equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
183+
sni = comma "sni" equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
184184
tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; }
185185
tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
186186
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); }

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ obfs_ss = comma "obfs-name" equals type:("http"/"tls") { obfs.type = type; }
158158
obfs_ssr = comma "obfs" equals type:("plain"/"http_simple"/"http_post"/"random_head"/"tls1.2_ticket_auth"/"tls1.2_ticket_fastauth") { obfs.type = type; }
159159
obfs_ssr_param = comma "obfs-param" equals match:$[^,]+ { proxy["obfs-param"] = match; }
160160

161-
obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; }
161+
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); }
162162
obfs_uri = comma "obfs-uri" equals uri:uri { obfs.path = uri; }
163163
uri = $[^,]+
164164

165165
transport = comma "transport" equals type:("tcp"/"ws"/"http") { transport.type = type; }
166-
transport_host = comma "host" equals host:domain { transport.host = host; }
166+
transport_host = comma "host" equals match:[^,]+ { transport.host = match.join("").replace(/^"(.*)"$/, '$1'); }
167167
transport_path = comma "path" equals path:uri { transport.path = path; }
168168

169169
ssr_protocol = comma "protocol" equals protocol:("origin"/"auth_sha1_v4"/"auth_aes128_md5"/"auth_aes128_sha1"/"auth_chain_a"/"auth_chain_b") { proxy.protocol = protocol; }
@@ -177,8 +177,8 @@ shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { proxy["shadow-tls-s
177177
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join(""); }
178178

179179
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
180-
tls_name = comma sni:("tls-name") equals host:domain { proxy.sni = host; }
181-
sni = comma sni:("sni") equals host:domain { proxy.sni = host; }
180+
tls_name = comma sni:("tls-name") equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
181+
sni = comma "sni" equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
182182
tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; }
183183
tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
184184
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); }

src/core/proxy-utils/parsers/peggy/qx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ udp_over_tcp_new = comma "udp-over-tcp" equals param:$[^=,]+ { if (param === "sp
162162
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
163163
164164
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
165-
tls_host = comma "tls-host" equals sni:domain { proxy.sni = sni; }
165+
tls_host = comma sni:("tls-host") equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
166166
tls_verification = comma "tls-verification" equals flag:bool {
167167
proxy["skip-cert-verify"] = !flag;
168168
}
@@ -180,7 +180,7 @@ obfs_ss = comma "obfs" equals type:("http"/"tls"/"wss"/"ws"/"over-tls") { obfs.t
180180
obfs_ssr = comma "obfs" equals type:("plain"/"http_simple"/"http_post"/"random_head"/"tls1.2_ticket_auth"/"tls1.2_ticket_fastauth") { proxy.type = "ssr"; obfs.type = type; return type; }
181181
obfs = comma "obfs" equals type:("wss"/"ws"/"over-tls"/"http") { obfs.type = type; return type; };
182182
183-
obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; }
183+
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); }
184184
obfs_uri = comma "obfs-uri" equals uri:uri { obfs.path = uri; }
185185
186186
ssr_protocol = comma "ssr-protocol" equals protocol:("origin"/"auth_sha1_v4"/"auth_aes128_md5"/"auth_aes128_sha1"/"auth_chain_a"/"auth_chain_b") { proxy.protocol = protocol; return protocol; }

src/core/proxy-utils/parsers/peggy/qx.peg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ udp_over_tcp_new = comma "udp-over-tcp" equals param:$[^=,]+ { if (param === "sp
160160
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
161161

162162
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
163-
tls_host = comma "tls-host" equals sni:domain { proxy.sni = sni; }
163+
tls_host = comma sni:("tls-host") equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
164164
tls_verification = comma "tls-verification" equals flag:bool {
165165
proxy["skip-cert-verify"] = !flag;
166166
}
@@ -178,7 +178,7 @@ obfs_ss = comma "obfs" equals type:("http"/"tls"/"wss"/"ws"/"over-tls") { obfs.t
178178
obfs_ssr = comma "obfs" equals type:("plain"/"http_simple"/"http_post"/"random_head"/"tls1.2_ticket_auth"/"tls1.2_ticket_fastauth") { proxy.type = "ssr"; obfs.type = type; return type; }
179179
obfs = comma "obfs" equals type:("wss"/"ws"/"over-tls"/"http") { obfs.type = type; return type; };
180180

181-
obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; }
181+
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); }
182182
obfs_uri = comma "obfs-uri" equals uri:uri { obfs.path = uri; }
183183

184184
ssr_protocol = comma "ssr-protocol" equals protocol:("origin"/"auth_sha1_v4"/"auth_aes128_md5"/"auth_aes128_sha1"/"auth_chain_a"/"auth_chain_b") { proxy.protocol = protocol; return protocol; }

src/core/proxy-utils/parsers/peggy/surge.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ username = & {
191191
password = comma match:[^,]+ { proxy.password = match.join("").replace(/^"(.*)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
192192
193193
tls = comma "tls" equals flag:bool { proxy.tls = flag; }
194-
sni = comma "sni" equals sni:("off"/domain) {
194+
sni = comma "sni" equals match:[^,]+ {
195+
const sni = match.join("").replace(/^"(.*)"$/, '$1');
195196
if (sni === "off") {
196197
proxy["disable-sni"] = true;
197198
} else {
@@ -227,7 +228,7 @@ ws_headers = comma "ws-headers" equals headers:$[^,]+ {
227228
ws_path = comma "ws-path" equals path:uri { obfs.path = path.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
228229
229230
obfs = comma "obfs" equals type:("http"/"tls") { obfs.type = type; }
230-
obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; };
231+
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); };
231232
obfs_uri = comma "obfs-uri" equals path:uri { obfs.path = path }
232233
uri = $[^,]+
233234

src/core/proxy-utils/parsers/peggy/surge.peg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ username = & {
188188
password = comma match:[^,]+ { proxy.password = match.join("").replace(/^"(.*)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
189189

190190
tls = comma "tls" equals flag:bool { proxy.tls = flag; }
191-
sni = comma "sni" equals sni:("off"/domain) {
191+
sni = comma "sni" equals match:[^,]+ {
192+
const sni = match.join("").replace(/^"(.*)"$/, '$1');
192193
if (sni === "off") {
193194
proxy["disable-sni"] = true;
194195
} else {
@@ -224,7 +225,7 @@ ws_headers = comma "ws-headers" equals headers:$[^,]+ {
224225
ws_path = comma "ws-path" equals path:uri { obfs.path = path.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
225226

226227
obfs = comma "obfs" equals type:("http"/"tls") { obfs.type = type; }
227-
obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; };
228+
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); };
228229
obfs_uri = comma "obfs-uri" equals path:uri { obfs.path = path }
229230
uri = $[^,]+
230231

src/core/proxy-utils/preprocessors/index.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,11 @@ function Clash() {
103103
},
104104
);
105105

106-
const {
107-
proxies,
108-
'global-client-fingerprint': globalClientFingerprint,
109-
} = safeLoad(afterReplace);
106+
const { proxies } = safeLoad(afterReplace);
110107
return (
111108
(includeProxies ? 'proxies:\n' : '') +
112109
proxies
113110
.map((p) => {
114-
if (
115-
globalClientFingerprint &&
116-
['trojan', 'vmess', 'vless'].includes(p.type) &&
117-
!p['client-fingerprint']
118-
) {
119-
p['client-fingerprint'] = globalClientFingerprint;
120-
}
121111
return `${includeProxies ? ' - ' : ''}${JSON.stringify(
122112
p,
123113
)}\n`;

src/core/proxy-utils/producers/clashmeta.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ export default function ClashMeta_Producer() {
7373
return true;
7474
})
7575
.map((proxy) => {
76-
if (['trojan', 'vmess', 'vless'].includes(proxy.type)) {
77-
proxy['client-fingerprint'] =
78-
proxy['client-fingerprint'] || 'chrome';
76+
if (proxy['reality-opts'] && !proxy['client-fingerprint']) {
77+
proxy['client-fingerprint'] = 'chrome';
7978
}
8079
if (proxy.type === 'vmess') {
8180
// handle vmess aead

src/core/proxy-utils/producers/surfboard.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function anytls(proxy) {
4545
result.appendIfPresent(`,password="${proxy.password}"`, 'password');
4646

4747
// tls verification
48-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
48+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
4949
result.appendIfPresent(
5050
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
5151
'skip-cert-verify',
@@ -166,7 +166,7 @@ function trojan(proxy) {
166166
result.appendIfPresent(`,tls=${proxy.tls}`, 'tls');
167167

168168
// tls verification
169-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
169+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
170170
result.appendIfPresent(
171171
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
172172
'skip-cert-verify',
@@ -200,7 +200,7 @@ function vmess(proxy) {
200200
result.appendIfPresent(`,tls=${proxy.tls}`, 'tls');
201201

202202
// tls verification
203-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
203+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
204204
result.appendIfPresent(
205205
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
206206
'skip-cert-verify',
@@ -220,7 +220,7 @@ function http(proxy) {
220220
result.appendIfPresent(`,${proxy.password}`, 'password');
221221

222222
// tls verification
223-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
223+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
224224
result.appendIfPresent(
225225
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
226226
'skip-cert-verify',
@@ -240,7 +240,7 @@ function socks5(proxy) {
240240
result.appendIfPresent(`,${proxy.password}`, 'password');
241241

242242
// tls verification
243-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
243+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
244244
result.appendIfPresent(
245245
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
246246
'skip-cert-verify',

src/core/proxy-utils/producers/surge.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function trojan(proxy) {
247247
);
248248

249249
// tls verification
250-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
250+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
251251
result.appendIfPresent(
252252
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
253253
'skip-cert-verify',
@@ -324,7 +324,7 @@ function anytls(proxy) {
324324
);
325325

326326
// tls verification
327-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
327+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
328328
result.appendIfPresent(
329329
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
330330
'skip-cert-verify',
@@ -390,7 +390,7 @@ function trusttunnel(proxy) {
390390
);
391391

392392
// tls verification
393-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
393+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
394394
result.appendIfPresent(
395395
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
396396
'skip-cert-verify',
@@ -469,7 +469,7 @@ function vmess(proxy, includeUnsupportedProxy) {
469469
result.appendIfPresent(`,tls=${proxy.tls}`, 'tls');
470470

471471
// tls verification
472-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
472+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
473473
result.appendIfPresent(
474474
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
475475
'skip-cert-verify',
@@ -617,7 +617,7 @@ function http(proxy) {
617617
);
618618

619619
// tls verification
620-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
620+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
621621
result.appendIfPresent(
622622
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
623623
'skip-cert-verify',
@@ -745,7 +745,7 @@ function socks5(proxy) {
745745
);
746746

747747
// tls verification
748-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
748+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
749749
result.appendIfPresent(
750750
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
751751
'skip-cert-verify',
@@ -922,7 +922,7 @@ function tuic(proxy) {
922922
);
923923

924924
// tls verification
925-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
925+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
926926
result.appendIfPresent(
927927
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
928928
'skip-cert-verify',
@@ -1203,7 +1203,7 @@ function hysteria2(proxy, includeUnsupportedProxy) {
12031203
);
12041204

12051205
// tls verification
1206-
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
1206+
result.appendIfPresent(`,sni="${proxy.sni}"`, 'sni');
12071207
result.appendIfPresent(
12081208
`,skip-cert-verify=${proxy['skip-cert-verify']}`,
12091209
'skip-cert-verify',

0 commit comments

Comments
 (0)