https://github.com/2dust/v2rayN/pull/7937
This commit is contained in:
DHR60 2025-09-13 10:17:26 +08:00
parent ec627bdb82
commit abbf8bba0d

View file

@ -72,11 +72,6 @@ public partial class CoreConfigSingboxService
} }
var hostsDomains = new List<string>(); var hostsDomains = new List<string>();
var systemHostsMap = Utils.GetSystemHosts();
foreach (var kvp in systemHostsMap)
{
hostsDomains.Add(kvp.Key);
}
var dnsItem = await AppManager.Instance.GetDNSItem(ECoreType.sing_box); var dnsItem = await AppManager.Instance.GetDNSItem(ECoreType.sing_box);
if (dnsItem == null || dnsItem.Enabled == false) if (dnsItem == null || dnsItem.Enabled == false)
{ {
@ -89,12 +84,23 @@ public partial class CoreConfigSingboxService
hostsDomains.Add(kvp.Key); hostsDomains.Add(kvp.Key);
} }
} }
if (simpleDNSItem.UseSystemHosts == true)
{
var systemHostsMap = Utils.GetSystemHosts();
foreach (var kvp in systemHostsMap)
{
hostsDomains.Add(kvp.Key);
}
}
} }
singboxConfig.route.rules.Add(new() if (hostsDomains.Count > 0)
{ {
action = "resolve", singboxConfig.route.rules.Add(new()
domain = hostsDomains, {
}); action = "resolve",
domain = hostsDomains,
});
}
singboxConfig.route.rules.Add(new() singboxConfig.route.rules.Add(new()
{ {