fix: remove routing rules when testing

This commit is contained in:
parhelia512 2025-09-01 00:52:01 +08:00 committed by GitHub
parent 4b742595e4
commit 3b56d8b429
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -682,16 +682,23 @@ namespace Configs {
// custom inbound // custom inbound
if (!status->forTest) QJSONARRAY_ADD(status->inbounds, QString2QJsonObject(dataStore->custom_inbound)["inbounds"].toArray()) if (!status->forTest) QJSONARRAY_ADD(status->inbounds, QString2QJsonObject(dataStore->custom_inbound)["inbounds"].toArray())
// DNS hijack deps
QJsonArray hijackDomains;
QJsonArray hijackDomainSuffix;
QJsonArray hijackDomainRegex;
QJsonArray hijackGeoAssets;
// manage routing section // manage routing section
auto routeObj = QJsonObject(); auto routeObj = QJsonObject();
if (!status->forTest) {
if (dataStore->spmode_vpn) { if (dataStore->spmode_vpn) {
routeObj["auto_detect_interface"] = true; routeObj["auto_detect_interface"] = true;
} }
if (dataStore->enable_stats && !status->forTest) if (dataStore->enable_stats)
{ {
routeObj["find_process"] = true; routeObj["find_process"] = true;
} }
if (!status->forTest) routeObj["final"] = outboundIDToString(routeChain->defaultOutboundID); routeObj["final"] = outboundIDToString(routeChain->defaultOutboundID);
if (!dataStore->routing->domain_strategy.isEmpty()) if (!dataStore->routing->domain_strategy.isEmpty())
{ {
@ -742,13 +749,7 @@ namespace Configs {
auto routeRules = routeChain->get_route_rules(false, outboundMap); auto routeRules = routeChain->get_route_rules(false, outboundMap);
routeObj["rules"] = routeRules; routeObj["rules"] = routeRules;
// DNS hijack deps if (dataStore->enable_dns_server) {
QJsonArray hijackDomains;
QJsonArray hijackDomainSuffix;
QJsonArray hijackDomainRegex;
QJsonArray hijackGeoAssets;
if (dataStore->enable_dns_server && !status->forTest) {
for (const auto& rule : dataStore->dns_server_rules) { for (const auto& rule : dataStore->dns_server_rules) {
if (rule.startsWith("ruleset:")) { if (rule.startsWith("ruleset:")) {
hijackGeoAssets << rule.mid(8); hijackGeoAssets << rule.mid(8);
@ -797,6 +798,7 @@ namespace Configs {
}; };
} }
routeObj["rule_set"] = ruleSetArray; routeObj["rule_set"] = ruleSetArray;
}
// DNS settings // DNS settings
QJsonObject dns; QJsonObject dns;