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

@@ -10,8 +10,7 @@ outbound["streamSettings"] = streamSettings;
namespace NekoRay::fmt {
QJsonObject V2rayStreamSettings::BuildStreamSettingsV2Ray() {
QJsonObject streamSettings{
{"network", network},
{"security", security},
{"network", network},
};
if (network == "ws") {
@@ -54,6 +53,7 @@ namespace NekoRay::fmt {
tls["alpn"] = QList2QJsonArray(alpn.split(","));
}
streamSettings["tlsSettings"] = tls;
streamSettings["security"] = "tls";
}
if (!header_type.isEmpty()) {

View File

@@ -35,7 +35,7 @@ namespace NekoRay::fmt {
QString VMessBean::InsecureHint() {
if (security == "none" || security == "zero") {
if (stream->security.isEmpty() || stream->security == "none") {
if (stream->security.isEmpty()) {
return QObject::tr(
"This profile is cleartext, don't use it if the server is not in your local network.");
}
@@ -51,14 +51,14 @@ namespace NekoRay::fmt {
}
QString TrojanVLESSBean::InsecureHint() {
if (stream->security.isEmpty() || stream->security == "none") {
if (stream->security.isEmpty()) {
return QObject::tr("This profile is cleartext, don't use it if the server is not in your local network.");
}
return {};
}
QString SocksHttpBean::InsecureHint() {
if (stream->security.isEmpty() || stream->security == "none") {
if (stream->security.isEmpty()) {
return QObject::tr("This profile is cleartext, don't use it if the server is not in your local network.");
}
return {};

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;
}

View File

@@ -5,6 +5,7 @@ namespace Preset {
inline const char *command = "--no-check -c %config%";
inline const char *config = "{\n"
" \"server\": \"127.0.0.1:%mapping_port%\",\n"
" \"server_name\": \"example.com\",\n"
" \"obfs\": \"fuck me till the daylight\",\n"
" \"up_mbps\": 10,\n"
" \"down_mbps\": 50,\n"