Fix DNS rule (#8866)

This commit is contained in:
DHR60 2026-03-01 10:38:16 +00:00 committed by GitHub
parent a71ebbd01c
commit 56f1794e47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -148,15 +148,20 @@ public partial class CoreConfigSingboxService
_coreConfig.dns ??= new Dns4Sbox(); _coreConfig.dns ??= new Dns4Sbox();
_coreConfig.dns.rules ??= []; _coreConfig.dns.rules ??= [];
_coreConfig.dns.rules.AddRange(new[] _coreConfig.dns.rules.Add(new() { ip_accept_any = true, server = Global.SingboxHostsDNSTag });
if (context.ProtectDomainList.Count > 0)
{ {
new Rule4Sbox { ip_accept_any = true, server = Global.SingboxHostsDNSTag }, _coreConfig.dns.rules.Add(new()
new Rule4Sbox
{ {
server = Global.SingboxDirectDNSTag, server = Global.SingboxDirectDNSTag,
strategy = Utils.DomainStrategy4Sbox(simpleDnsItem.Strategy4Freedom), strategy = Utils.DomainStrategy4Sbox(simpleDnsItem.Strategy4Freedom),
domain = context.ProtectDomainList.ToList(), domain = context.ProtectDomainList.ToList(),
}, });
}
_coreConfig.dns.rules.AddRange(new[]
{
new Rule4Sbox new Rule4Sbox
{ {
server = Global.SingboxRemoteDNSTag, server = Global.SingboxRemoteDNSTag,