Modify rules order so that dns can be routed normally in Global mode. (#844)

This commit is contained in:
Henri 2025-05-21 20:34:15 +08:00 committed by GitHub
parent b99c679a6e
commit 82f3467e9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -532,6 +532,9 @@ void rulesetToSingBox(rapidjson::Document &base_rule, std::vector<RulesetContent
rules.Swap(base_rule["route"]["rules"]);
}
auto dns_object = buildObject(allocator, "protocol", "dns", "outbound", "dns-out");
rules.PushBack(dns_object, allocator);
if (global.singBoxAddClashModes)
{
auto global_object = buildObject(allocator, "clash_mode", "Global", "outbound", "GLOBAL");
@ -540,9 +543,6 @@ void rulesetToSingBox(rapidjson::Document &base_rule, std::vector<RulesetContent
rules.PushBack(direct_object, allocator);
}
auto dns_object = buildObject(allocator, "protocol", "dns", "outbound", "dns-out");
rules.PushBack(dns_object, allocator);
std::vector<std::string_view> temp(4);
for(RulesetContent &x : ruleset_content_array)
{