feat(surge): export AnyTLS proxies for Surge 4+

Generate anytls policy lines with password, optional sni, skip-cert-verify,
server-cert-fingerprint-sha256, and tls13, matching Surge manual syntax.

Assisted-by: Cursor (GPT-5.4)
Made-with: Cursor
This commit is contained in:
gengjiawen committed 2026-04-16 06:47:56 +00:00
1 parent cd74f4dc22
commit 801450a2c0
1 file changed
+13
+13
View File
@@ -1115,6 +1115,19 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
if (!x.Ports.empty())
proxy += ",port-hopping=" + x.Ports;
break;
case ProxyType::AnyTLS:
if (surge_ver < 4)
continue;
proxy = "anytls, " + hostname + ", " + port + ", password=" + password;
if (!x.SNI.empty())
proxy += ", sni=" + x.SNI;
if (!scv.is_undef())
proxy += ", skip-cert-verify=" + scv.get_str();
if (!x.Fingerprint.empty())
proxy += ", server-cert-fingerprint-sha256=" + x.Fingerprint;
if (!tls13.is_undef())
proxy += ", tls13=" + std::string(tls13 ? "true" : "false");
break;
case ProxyType::WireGuard:
if (surge_ver < 4 && surge_ver != -3)
continue;