+ dnsfilter: use callback function for applying per-client settings

This commit is contained in:
Simon Zolin
2019-05-28 14:14:12 +03:00
parent 4bb7b654ab
commit 8bf76c331d
3 changed files with 98 additions and 23 deletions

View File

@@ -378,7 +378,11 @@ func (s *Server) filterDNSRequest(d *proxy.DNSContext) (*dnsfilter.Result, error
var res dnsfilter.Result
var err error
res, err = dnsFilter.CheckHost(host, d.Req.Question[0].Qtype)
clientAddr := ""
if d.Addr != nil {
clientAddr, _, _ = net.SplitHostPort(d.Addr.String())
}
res, err = dnsFilter.CheckHost(host, d.Req.Question[0].Qtype, clientAddr)
if err != nil {
// Return immediately if there's an error
return nil, errorx.Decorate(err, "dnsfilter failed to check host '%s'", host)