feat: add shadow-tls filtering and AnyTLS Surge INI import

- Filter shadow-tls nodes by setting port to '0' (triggers existing skip logic)
- Add AnyTLS proxy type support in Surge INI-style config import
- Supports password, sni, skip-cert-verify, fingerprint, tls13 fields
This commit is contained in:
feisan committed 2026-05-26 13:48:05 +08:00
1 parent 633ecd5a3b
commit 3c640b1976
1 file changed
+51
+51
View File
@@ -2073,10 +2073,17 @@ bool explodeSurge(std::string surge, std::vector<Proxy> &nodes) {
case "tfo"_hash:
tfo = itemVal;
break;
case "shadow-tls-sni"_hash:
case "shadow-tls-password"_hash:
case "shadow-tls-version"_hash:
port = "0";
break;
default:
continue;
}
}
if (port == "0")
continue;
if (!plugin.empty()) {
pluginopts = "obfs=" + pluginopts_mode;
pluginopts += pluginopts_host.empty() ? "" : ";obfs-host=" + pluginopts_host;
@@ -2120,10 +2127,17 @@ bool explodeSurge(std::string surge, std::vector<Proxy> &nodes) {
case "tfo"_hash:
tfo = itemVal;
break;
case "shadow-tls-sni"_hash:
case "shadow-tls-password"_hash:
case "shadow-tls-version"_hash:
port = "0";
break;
default:
continue;
}
}
if (port == "0")
continue;
if (!plugin.empty()) {
pluginopts = "obfs=" + pluginopts_mode;
pluginopts += pluginopts_host.empty() ? "" : ";obfs-host=" + pluginopts_host;
@@ -2395,6 +2409,43 @@ bool explodeSurge(std::string surge, std::vector<Proxy> &nodes) {
mtu, keepalive, test_url, "", udp, "");
parsePeers(node, peer);
break;
case "anytls"_hash: //Surge style anytls proxy
server = trim(configs[1]);
port = trim(configs[2]);
if (port == "0")
continue;
for (i = 3; i < configs.size(); i++) {
vArray = split(configs[i], "=");
if (vArray.size() != 2)
continue;
itemName = trim(vArray[0]);
itemVal = trim(vArray[1]);
switch (hash_(itemName)) {
case "password"_hash:
password = itemVal;
break;
case "sni"_hash:
sni = itemVal;
break;
case "skip-cert-verify"_hash:
scv = itemVal;
break;
case "fingerprint"_hash:
fp = itemVal;
break;
case "tls13"_hash:
tls13 = itemVal;
break;
default:
continue;
}
}
anyTlSConstruct(node, ANYTLS_DEFAULT_GROUP, remarks, port, password, server,
std::vector<std::string>{}, fp, sni,
udp, tribool(), scv, tribool(), "", 30, 30, 0);
break;
default:
switch (hash_(remarks)) {
case "shadowsocks"_hash: //quantumult x style ss/ssr link