Add safesearch test for dnsforward
This commit is contained in:
@@ -637,6 +637,7 @@ func (d *Dnsfilter) checkSafeSearch(host string) (Result, error) {
|
||||
return Result{}, err
|
||||
}
|
||||
|
||||
res.IP = addrs[0]
|
||||
// The next bug may occurs: LookupIP returns DNS64 mapped ipv4 address with zero-prefix
|
||||
for _, i := range addrs {
|
||||
if ipv4 := i.To4(); ipv4 != nil && len(i) == net.IPv6len {
|
||||
@@ -645,10 +646,6 @@ func (d *Dnsfilter) checkSafeSearch(host string) (Result, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if res.IP == nil || len(res.IP) == 0 {
|
||||
res.IP = addrs[0]
|
||||
}
|
||||
|
||||
// Cache result
|
||||
err = safeSearchCache.Set(host, res)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user