From 056b787a109e317de43ab04374dd567c08079286 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Tue, 11 Mar 2025 10:22:25 +0800 Subject: [PATCH] Refine default fallback load balancing rule based on domain strategy --- .../CoreConfig/CoreConfigV2rayService.cs | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index 4ab2fbd0..4077ea8c 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -182,12 +182,24 @@ namespace ServiceLib.Services.CoreConfig rule.balancerTag = balancer.tag; } } - v2rayConfig.routing.rules.Add(new() + if (v2rayConfig.routing.domainStrategy == "IPIfNonMatch") { - ip = ["0.0.0.0/0", "::/0"], - balancerTag = balancer.tag, - type = "field" - }); + v2rayConfig.routing.rules.Add(new() + { + ip = ["0.0.0.0/0", "::/0"], + balancerTag = balancer.tag, + type = "field" + }); + } + else + { + v2rayConfig.routing.rules.Add(new() + { + network = "tcp,udp", + balancerTag = balancer.tag, + type = "field" + }); + } ret.Success = true; ret.Data = JsonUtils.Serialize(v2rayConfig);