Remove unnecessary filter

localhost-DNS-queryStrategy
风扇滑翔翼 2025-01-19 04:52:29 +00:00 committed by GitHub
parent 7b92e1c82a
commit afe2b58a8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 17 deletions

View File

@ -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})