Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests
This commit is contained in:
@@ -2,6 +2,7 @@ package dnsfilter
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"encoding/gob"
|
||||
"encoding/json"
|
||||
@@ -101,15 +102,14 @@ func (d *DNSFilter) checkSafeSearch(host string) (Result, error) {
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// TODO this address should be resolved with upstream that was configured in dnsforward
|
||||
ips, err := net.LookupIP(safeHost)
|
||||
ipAddrs, err := d.resolver.LookupIPAddr(context.Background(), safeHost)
|
||||
if err != nil {
|
||||
log.Tracef("SafeSearchDomain for %s was found but failed to lookup for %s cause %s", host, safeHost, err)
|
||||
return Result{}, err
|
||||
}
|
||||
|
||||
for _, ip := range ips {
|
||||
if ipv4 := ip.To4(); ipv4 != nil {
|
||||
for _, ipAddr := range ipAddrs {
|
||||
if ipv4 := ipAddr.IP.To4(); ipv4 != nil {
|
||||
res.Rules[0].IP = ipv4
|
||||
|
||||
l := d.setCacheResult(gctx.safeSearchCache, host, res)
|
||||
|
||||
Reference in New Issue
Block a user