This commit is contained in:
parhelia512 2025-09-25 12:52:03 +08:00 committed by GitHub
parent cb30dbadc9
commit c35724abaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -286,7 +286,7 @@ namespace Subscription {
// VLESS // VLESS
if (out["type"] == "vless") { if (out["type"] == "vless") {
ent = Configs::ProfileManager::NewProxyEntity("vless"); ent = Configs::ProfileManager::NewProxyEntity("vless");
auto ok = ent->TrojanVLESSBean()->TryParseJson(out); auto ok = ent->VLESSBean()->TryParseJson(out);
if (!ok) continue; if (!ok) continue;
} }
@ -501,7 +501,7 @@ namespace Subscription {
} else { } else {
bean->password = Node2QString(proxy["password"]); bean->password = Node2QString(proxy["password"]);
} }
if (Node2Bool(proxy["tls"])) bean->stream->security = "tls"; bean->stream->security = "tls";
bean->stream->network = Node2QString(proxy["network"], "tcp"); bean->stream->network = Node2QString(proxy["network"], "tcp");
bean->stream->sni = FIRST_OR_SECOND(Node2QString(proxy["sni"]), Node2QString(proxy["servername"])); bean->stream->sni = FIRST_OR_SECOND(Node2QString(proxy["sni"]), Node2QString(proxy["servername"]));
bean->stream->alpn = Node2QStringList(proxy["alpn"]).join(","); bean->stream->alpn = Node2QStringList(proxy["alpn"]).join(",");
@ -522,8 +522,10 @@ namespace Subscription {
if (headers.is_mapping()) { if (headers.is_mapping()) {
for (auto header: headers.as_map()) { for (auto header: headers.as_map()) {
if (Node2QString(header.first).toLower() == "host") { if (Node2QString(header.first).toLower() == "host") {
bean->stream->host = Node2QString(header.second); if (header.second.is_string())
break; bean->stream->host = Node2QString(header.second);
else if (header.second.is_sequence() && header.second[0].is_string())
bean->stream->host = Node2QString(header.second[0]);
} }
} }
} }
@ -542,13 +544,6 @@ namespace Subscription {
bean->stream->reality_pbk = Node2QString(reality["public-key"]); bean->stream->reality_pbk = Node2QString(reality["public-key"]);
bean->stream->reality_sid = Node2QString(reality["short-id"]); bean->stream->reality_sid = Node2QString(reality["short-id"]);
} }
if (bean->stream->network == "tcp" && bean->stream->security.isEmpty()) {
if (bean->stream->header_type.isEmpty())
bean->stream->header_type = "http";
if (bean->stream->path.isEmpty())
bean->stream->path = "/";
}
} else if (type == "vmess") { } else if (type == "vmess") {
needFix = true; needFix = true;
auto bean = ent->VMessBean(); auto bean = ent->VMessBean();
@ -624,11 +619,8 @@ namespace Subscription {
auto paths = tcp_http["path"]; auto paths = tcp_http["path"];
if (paths.is_string()) if (paths.is_string())
bean->stream->path = Node2QString(paths); bean->stream->path = Node2QString(paths);
else if (paths.is_sequence()) else if (paths.is_sequence() && paths[0].is_string())
for (auto path: paths) { bean->stream->path = Node2QString(paths[0]);
bean->stream->path = Node2QString(path);
break;
}
} }
} else if (type == "anytls") { } else if (type == "anytls") {
needFix = true; needFix = true;