Remove legacy sing-box dns compatibility (#9163)

This commit is contained in:
DHR60
2026-04-20 10:58:56 +00:00
committed by GitHub
parent d67321eed0
commit 90b055e364
3 changed files with 9 additions and 38 deletions
@@ -429,15 +429,7 @@ public partial class CoreConfigSingboxService
return;
}
_coreConfig.dns = dns4Sbox;
if (dns4Sbox.servers?.Count > 0 &&
dns4Sbox.servers.First().address.IsNullOrEmpty())
{
GenDnsProtectCustom();
}
else
{
GenDnsProtectCustomLegacy();
}
GenDnsProtectCustom();
}
catch (Exception ex)
{
@@ -479,23 +471,6 @@ public partial class CoreConfigSingboxService
_coreConfig.dns = dns4Sbox;
}
private void GenDnsProtectCustomLegacy()
{
GenDnsProtectCustom();
_coreConfig.dns?.servers?.RemoveAll(s => s.tag == Global.SingboxLocalDNSTag);
var dnsItem = context.RawDnsItem;
var localDnsServer = new Server4Sbox()
{
address = string.IsNullOrEmpty(dnsItem?.DomainDNSAddress)
? Global.DomainPureIPDNSAddress.FirstOrDefault()
: dnsItem?.DomainDNSAddress,
tag = Global.SingboxLocalDNSTag,
detour = Global.DirectTag,
};
_coreConfig.dns?.servers?.Add(localDnsServer);
}
private Rule4Sbox? BuildProtectDomainRule()
{
if (context.ProtectDomainList.Count == 0)