Add support for SOCKS5 nodes in Loon configs

This commit is contained in:
Tindy X 2023-10-08 02:40:27 +08:00
parent 5de1a3fef0
commit c3e8e88fb6
No known key found for this signature in database
GPG Key ID: CD068E6DB6C55A1C

View File

@ -1849,6 +1849,19 @@ std::string proxyToLoon(std::vector<Proxy> &nodes, const std::string &base_conf,
if(!scv.is_undef())
proxy += ",skip-cert-verify=" + std::string(scv.get() ? "true" : "false");
break;
case ProxyType::SOCKS5:
proxy = "socks5," + hostname + "," + port;
if (!username.empty() && !password.empty())
proxy += "," + username + ",\"" + password + "\"";
proxy += ",over-tls=" + std::string(tlssecure ? "true" : "false");
if (tlssecure)
{
if(!host.empty())
proxy += ",tls-name=" + host;
if(!scv.is_undef())
proxy += ",skip-cert-verify=" + std::string(scv.get() ? "true" : "false");
}
break;
default:
continue;
}