fix: tls sni parse

This commit is contained in:
arm64v8a
2022-11-07 11:33:15 +09:00
parent b4fe36137f
commit e88ec1c127
9 changed files with 33 additions and 28 deletions

View File

@@ -35,7 +35,7 @@ namespace NekoRay::fmt {
password = url.password();
if (serverPort == -1) serverPort = socks_http_type == type_HTTP ? 443 : 1080;
stream->security = GetQueryValue(query, "security", "") == "true" ? "tls" : "none";
stream->security = GetQueryValue(query, "security", "");
stream->sni = GetQueryValue(query, "sni");
}
return true;
@@ -124,13 +124,7 @@ namespace NekoRay::fmt {
auto scy = objN["scy"].toString();
if (!scy.isEmpty()) security = scy;
// TLS (XTLS?)
if (!objN["tls"].toString().isEmpty() && objN["tls"].toString().toLower() != "none")
stream->security = "tls";
if (stream->security == "tls" && IsIpAddress(serverAddress) &&
(!stream->host.isEmpty()) && stream->sni.isEmpty()) {
// v2rayN config builder generate sni like this, so set sni here for their format.
stream->sni = stream->host;
}
stream->security = objN["tls"].toString();
// TODO quic & kcp
return true;
}