From 897a4e5635ee41720685bfe192c0dae664e8c66e Mon Sep 17 00:00:00 2001 From: DHR60 Date: Mon, 5 May 2025 13:59:14 +0800 Subject: [PATCH] Move exe direct rule before clash_mode (#7236) --- .../CoreConfig/CoreConfigSingboxService.cs | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs index 54054d43..358fbaf0 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs @@ -979,26 +979,6 @@ public class CoreConfigSingboxService try { var dnsOutbound = "dns_out"; - if (!_config.Inbound.First().SniffingEnabled) - { - singboxConfig.route.rules.Add(new() - { - port = [53], - network = ["udp"], - outbound = dnsOutbound - }); - } - - singboxConfig.route.rules.Add(new() - { - outbound = Global.DirectTag, - clash_mode = ERuleMode.Direct.ToString() - }); - singboxConfig.route.rules.Add(new() - { - outbound = Global.ProxyTag, - clash_mode = ERuleMode.Global.ToString() - }); if (_config.TunModeItem.EnableTun) { @@ -1025,6 +1005,27 @@ public class CoreConfigSingboxService }); } + if (!_config.Inbound.First().SniffingEnabled) + { + singboxConfig.route.rules.Add(new() + { + port = [53], + network = ["udp"], + outbound = dnsOutbound + }); + } + + singboxConfig.route.rules.Add(new() + { + outbound = Global.DirectTag, + clash_mode = ERuleMode.Direct.ToString() + }); + singboxConfig.route.rules.Add(new() + { + outbound = Global.ProxyTag, + clash_mode = ERuleMode.Global.ToString() + }); + var routing = await ConfigHandler.GetDefaultRouting(_config); if (routing != null) {