mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-30 08:28:10 +00:00
feat: Surge Snell v6.0.0b3 新增 mode 字段
This commit is contained in:
5 files changed
+40
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.24.21",
|
||||
"version": "2.24.22",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
|
||||
"main": "src/main.js",
|
||||
"packageManager": "pnpm@11.0.9",
|
||||
|
||||
@@ -397,7 +397,7 @@ ssh = tag equals "ssh" address (username password)? (usernamek passwordk)? (serv
|
||||
proxy.type = "ssh";
|
||||
handleShadowTLS();
|
||||
}
|
||||
snell = tag equals "snell" address (snell_version/snell_psk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/reuse/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
||||
snell = tag equals "snell" address (snell_version/snell_mode/snell_psk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/reuse/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
|
||||
proxy.type = "snell";
|
||||
// handle obfs
|
||||
if (obfs.type == "http" || obfs.type === "tls") {
|
||||
@@ -520,6 +520,12 @@ client_cert = comma "client-cert" equals match:[^,]+ { proxy["keystore-client-ce
|
||||
|
||||
snell_psk = comma "psk" equals match:[^,]+ { proxy.psk = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||||
snell_version = comma "version" equals match:$[0-9]+ { proxy.version = parseInt(match.trim()); }
|
||||
snell_mode = comma "mode" equals match:[^,]+ {
|
||||
const mode = stripQuotes(match.join("")).trim();
|
||||
if (["default", "unshaped", "unsafe-raw"].includes(mode)) {
|
||||
proxy.mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
usernamek = comma "username" equals match:[^,]+ { proxy.username = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||||
passwordk = comma "password" equals match:[^,]+ { proxy.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||||
|
||||
@@ -946,6 +946,9 @@ function snell(proxy) {
|
||||
result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
|
||||
result.appendIfPresent(`,version=${proxy.version}`, 'version');
|
||||
result.appendIfPresent(`,psk="${proxy.psk}"`, 'psk');
|
||||
if (Number(proxy.version) === 6) {
|
||||
result.appendIfPresent(`,mode=${proxy.mode}`, 'mode');
|
||||
}
|
||||
|
||||
const ip_version = ipVersions[proxy['ip-version']] || proxy['ip-version'];
|
||||
result.appendIfPresent(`,ip-version=${ip_version}`, 'ip-version');
|
||||
|
||||
@@ -3655,6 +3655,20 @@ describe('Platform raw-format parser coverage', function () {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'parses snell v6 mode lines',
|
||||
input: 'Surge Snell v6 = snell,surge-snell.example.com,443,psk=secret,version=6,mode=unshaped,udp-relay=true',
|
||||
expected: {
|
||||
type: 'snell',
|
||||
name: 'Surge Snell v6',
|
||||
server: 'surge-snell.example.com',
|
||||
port: 443,
|
||||
psk: 'secret',
|
||||
version: 6,
|
||||
mode: 'unshaped',
|
||||
udp: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'parses tuic v5 lines',
|
||||
input: `Surge TUIC = tuic-v5,surge-tuic.example.com,443,uuid=${UUID},password=secret,sni=sni.example.com,skip-cert-verify=true,alpn=h3,ecn=true,port-hopping=9000;9002-9004`,
|
||||
|
||||
@@ -914,6 +914,17 @@ describe('Proxy text producers', function () {
|
||||
port: 443,
|
||||
psk: 'secret',
|
||||
version: 6,
|
||||
mode: 'unsafe-raw',
|
||||
udp: true,
|
||||
},
|
||||
{
|
||||
type: 'snell',
|
||||
name: 'Surge Snell v5 Mode',
|
||||
server: 'snell.example.com',
|
||||
port: 443,
|
||||
psk: 'secret',
|
||||
version: 5,
|
||||
mode: 'unshaped',
|
||||
udp: true,
|
||||
},
|
||||
{
|
||||
@@ -937,7 +948,10 @@ describe('Proxy text producers', function () {
|
||||
);
|
||||
|
||||
expect(output).to.equal(
|
||||
'Surge Snell v6=snell,snell.example.com,443,version=6,psk="secret",udp-relay=true',
|
||||
[
|
||||
'Surge Snell v6=snell,snell.example.com,443,version=6,psk="secret",mode=unsafe-raw,udp-relay=true',
|
||||
'Surge Snell v5 Mode=snell,snell.example.com,443,version=5,psk="secret",udp-relay=true',
|
||||
].join('\n'),
|
||||
);
|
||||
expect(errors).to.deep.equal([
|
||||
'Platform Surge does not support Snell version 6 with obfs',
|
||||
|
||||
Reference in new issue
Block a user