Avoids detour for private networks

This commit is contained in:
DHR60 2025-07-27 20:05:19 +08:00
parent b2f9ec4464
commit 916e6d2050
2 changed files with 2 additions and 2 deletions

View file

@ -2232,7 +2232,7 @@ public class CoreConfigSingboxService
continue; continue;
} }
} }
else if (outbound.detour.IsNullOrEmpty() && (!customConfig.ProxyDetour.IsNullOrEmpty())) else if (outbound.detour.IsNullOrEmpty() && (!customConfig.ProxyDetour.IsNullOrEmpty()) && !Utils.IsPrivateNetwork(outbound.server ?? string.Empty))
{ {
outbound.detour = customConfig.ProxyDetour; outbound.detour = customConfig.ProxyDetour;
} }

View file

@ -1910,7 +1910,7 @@ public class CoreConfigV2rayService
continue; continue;
} }
} }
else if ((outbound.streamSettings?.sockopt?.dialerProxy.IsNullOrEmpty() == true) && (!customConfig.ProxyDetour.IsNullOrEmpty())) else if ((outbound.streamSettings?.sockopt?.dialerProxy.IsNullOrEmpty() == true) && (!customConfig.ProxyDetour.IsNullOrEmpty()) && !(Utils.IsPrivateNetwork(outbound.settings?.servers?.FirstOrDefault()?.address ?? string.Empty) || Utils.IsPrivateNetwork(outbound.settings?.vnext?.FirstOrDefault()?.address ?? string.Empty)))
{ {
outbound.streamSettings ??= new StreamSettings4Ray(); outbound.streamSettings ??= new StreamSettings4Ray();
outbound.streamSettings.sockopt ??= new Sockopt4Ray(); outbound.streamSettings.sockopt ??= new Sockopt4Ray();