From 09ea4890a76b174ecca7f1a69c22cc79bc85fc34 Mon Sep 17 00:00:00 2001 From: DHR60 <192860629+DHR60@users.noreply.github.com> Date: Thu, 16 Jul 2026 09:37:17 +0000 Subject: [PATCH] Fix (#9771) --- .../Singbox/SingboxRoutingService.cs | 23 +++++++++++-------- .../CoreConfig/V2ray/V2rayRoutingService.cs | 23 +++++++++++-------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs index b8175b3f..9c30ae61 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs @@ -35,18 +35,21 @@ public partial class CoreConfigSingboxService } var lstDirectExe = BuildRoutingDirectExe(); - _coreConfig.route.rules.Add(new() + if (lstDirectExe.Count > 0) { - port = [53], - action = "hijack-dns", - process_path = lstDirectExe - }); + _coreConfig.route.rules.Add(new() + { + port = [53], + action = "hijack-dns", + process_path = lstDirectExe, + }); - _coreConfig.route.rules.Add(new() - { - outbound = Global.DirectTag, - process_path = lstDirectExe - }); + _coreConfig.route.rules.Add(new() + { + outbound = Global.DirectTag, + process_path = lstDirectExe, + }); + } // ICMP Routing var icmpRouting = _config.TunModeItem.IcmpRouting ?? ""; diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayRoutingService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayRoutingService.cs index 2349fe7f..fed39b47 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayRoutingService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayRoutingService.cs @@ -14,17 +14,20 @@ public partial class CoreConfigV2rayService _coreConfig.routing.rules.AddRange(tunRules); } var lstDirectExe = BuildRoutingDirectExe(); - _coreConfig.routing.rules.Add(new() + if (lstDirectExe.Count > 0) { - port = "53", - process = lstDirectExe, - outboundTag = Global.DnsOutboundTag, - }); - _coreConfig.routing.rules.Add(new() - { - process = lstDirectExe, - outboundTag = Global.DirectTag, - }); + _coreConfig.routing.rules.Add(new() + { + port = "53", + process = lstDirectExe, + outboundTag = Global.DnsOutboundTag, + }); + _coreConfig.routing.rules.Add(new() + { + process = lstDirectExe, + outboundTag = Global.DirectTag, + }); + } _coreConfig.routing.rules.Add(new() { inboundTag = ["tun"],