Skip to content

Commit 56f1794

Browse files
authored
Fix DNS rule (#8866)
1 parent a71ebbd commit 56f1794

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,20 @@ private void GenDnsRules()
148148
_coreConfig.dns ??= new Dns4Sbox();
149149
_coreConfig.dns.rules ??= [];
150150

151-
_coreConfig.dns.rules.AddRange(new[]
151+
_coreConfig.dns.rules.Add(new() { ip_accept_any = true, server = Global.SingboxHostsDNSTag });
152+
153+
if (context.ProtectDomainList.Count > 0)
152154
{
153-
new Rule4Sbox { ip_accept_any = true, server = Global.SingboxHostsDNSTag },
154-
new Rule4Sbox
155+
_coreConfig.dns.rules.Add(new()
155156
{
156157
server = Global.SingboxDirectDNSTag,
157158
strategy = Utils.DomainStrategy4Sbox(simpleDnsItem.Strategy4Freedom),
158159
domain = context.ProtectDomainList.ToList(),
159-
},
160+
});
161+
}
162+
163+
_coreConfig.dns.rules.AddRange(new[]
164+
{
160165
new Rule4Sbox
161166
{
162167
server = Global.SingboxRemoteDNSTag,

0 commit comments

Comments
 (0)