From 1d653535ba8935876975788f9fb72014a440074b Mon Sep 17 00:00:00 2001 From: Valeriy Manzhos <47538801+InvisibleRain@users.noreply.github.com> Date: Thu, 9 Apr 2026 18:45:02 +0300 Subject: [PATCH] Don't generate TUN config for sing-box on Linux --- .../Services/CoreConfig/Singbox/SingboxConfigTemplateService.cs | 2 +- .../ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs | 2 +- .../Services/CoreConfig/Singbox/SingboxInboundService.cs | 2 +- .../Services/CoreConfig/Singbox/SingboxRoutingService.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxConfigTemplateService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxConfigTemplateService.cs index 25b29701..7f7b0b13 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxConfigTemplateService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxConfigTemplateService.cs @@ -10,7 +10,7 @@ public partial class CoreConfigSingboxService return JsonUtils.Serialize(_coreConfig); } - var fullConfigTemplateItem = context.IsTunEnabled ? fullConfigTemplate.TunConfig : fullConfigTemplate.Config; + var fullConfigTemplateItem = (context.IsTunEnabled && !Utils.IsLinux()) ? fullConfigTemplate.TunConfig : fullConfigTemplate.Config; if (fullConfigTemplateItem.IsNullOrEmpty()) { return JsonUtils.Serialize(_coreConfig); diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs index f09d3ee9..8504042d 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs @@ -414,7 +414,7 @@ public partial class CoreConfigSingboxService { var item = context.RawDnsItem; var strDNS = string.Empty; - if (context.IsTunEnabled) + if (context.IsTunEnabled && !Utils.IsLinux()) { strDNS = string.IsNullOrEmpty(item?.TunDNS) ? EmbedUtils.GetEmbedText(Global.TunSingboxDNSFileName) : item?.TunDNS; } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxInboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxInboundService.cs index 3a27c7da..42f55615 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxInboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxInboundService.cs @@ -50,7 +50,7 @@ public partial class CoreConfigSingboxService } } - if (context.IsTunEnabled) + if (context.IsTunEnabled && !Utils.IsLinux()) { if (_config.TunModeItem.Mtu <= 0) { diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs index 01c32cc2..75bb6894 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs @@ -24,7 +24,7 @@ public partial class CoreConfigSingboxService strategy = directDnsStrategy }; - if (_config.TunModeItem.EnableTun) + if (_config.TunModeItem.EnableTun && !Utils.IsLinux()) { _coreConfig.route.auto_detect_interface = true;