From afe2b58a8da57b743b6071a4f942e2e7f9b08226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E6=89=87=E6=BB=91=E7=BF=94=E7=BF=BC?= Date: Sun, 19 Jan 2025 04:52:29 +0000 Subject: [PATCH] Remove unnecessary filter --- app/dns/nameserver_local.go | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/app/dns/nameserver_local.go b/app/dns/nameserver_local.go index ff10cd7e..14de8356 100644 --- a/app/dns/nameserver_local.go +++ b/app/dns/nameserver_local.go @@ -34,23 +34,6 @@ func (s *LocalNameServer) QueryIP(ctx context.Context, domain string, _ net.IP, err = dns.ErrEmptyResponse } - // If ipv4 or ipv6 is disabled, filter out the unwanted IPs - if err != nil && (!option.IPv4Enable || !option.IPv6Enable) { - var FilteredIPs []net.IP - for _, ip := range ips { - if option.IPv4Enable && len(ip) == net.IPv4len { - FilteredIPs = append(FilteredIPs, ip) - } - if option.IPv6Enable && len(ip) == net.IPv6len { - FilteredIPs = append(FilteredIPs, ip) - } - } - if len(FilteredIPs) == 0 { - err = dns.ErrEmptyResponse - } - ips = FilteredIPs - } - if len(ips) > 0 { errors.LogInfo(ctx, "Localhost got answer: ", domain, " -> ", ips) log.Record(&log.DNSLog{Server: s.Name(), Domain: domain, Result: ips, Status: log.DNSQueried, Elapsed: time.Since(start), Error: err})