Merge pull request #78 in DNS/adguard-dns from fix/368 to master

* commit 'aa691a068add3a29dd06b65d595b633750120eeb':
  Fix #368
This commit is contained in:
Eugene Bujak 2018-10-15 15:00:03 +03:00
commit a126a3868c

View File

@ -12,20 +12,16 @@ import (
"sync" "sync"
"time" "time"
"github.com/AdguardTeam/AdguardDNS/dnsfilter"
"github.com/coredns/coredns/core/dnsserver" "github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin" "github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/metrics" "github.com/coredns/coredns/plugin/metrics"
"github.com/coredns/coredns/plugin/pkg/dnstest" "github.com/coredns/coredns/plugin/pkg/dnstest"
"github.com/coredns/coredns/plugin/pkg/upstream" "github.com/coredns/coredns/plugin/pkg/upstream"
"github.com/coredns/coredns/request" "github.com/coredns/coredns/request"
"github.com/mholt/caddy" "github.com/mholt/caddy"
"github.com/miekg/dns" "github.com/miekg/dns"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/AdguardTeam/AdguardDNS/dnsfilter"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
@ -450,7 +446,9 @@ func (p *plug) serveDNSInternal(ctx context.Context, w dns.ResponseWriter, r *dn
if err != nil { if err != nil {
return rcode, dnsfilter.Result{}, err return rcode, dnsfilter.Result{}, err
} }
return rcode, dnsfilter.Result{Reason: dnsfilter.FilteredSafeSearch}, err // TODO: This must be handled in the dnsfilter and not here!
rule := val.String() + " " + host
return rcode, dnsfilter.Result{Reason: dnsfilter.FilteredBlackList, Rule: rule}, err
} }
// needs to be filtered instead // needs to be filtered instead