Use Proxy.Host as alternative tls.server_name in sing-box to support Trojan's sni (#777)

Co-authored-by: Spade Lushen <7971040+SpadeLushen@users.noreply.github.com>
This commit is contained in:
SpadeLushen 2024-08-27 17:33:02 +08:00 committed by GitHub
parent 6974910734
commit 0c11565cc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2268,6 +2268,8 @@ void proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json, std::v
tls.AddMember("enabled", true, allocator);
if (!x.ServerName.empty())
tls.AddMember("server_name", rapidjson::StringRef(x.ServerName.c_str()), allocator);
else if (!x.Host.empty())
tls.AddMember("server_name", rapidjson::StringRef(x.Host.c_str()), allocator);
tls.AddMember("insecure", buildBooleanValue(scv), allocator);
proxy.AddMember("tls", tls, allocator);
}