From 0da177c3afef63b50a24615b7f87fddf3eb03b5c Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Fri, 9 Oct 2020 00:04:24 +0800 Subject: [PATCH] Fix: the priority of fake-ip-filter --- dns/middleware.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dns/middleware.go b/dns/middleware.go index 8aff0647..e14bd13a 100644 --- a/dns/middleware.go +++ b/dns/middleware.go @@ -102,6 +102,11 @@ func withFakeIP(fakePool *fakeip.Pool) middleware { return func(r *D.Msg) (*D.Msg, error) { q := r.Question[0] + host := strings.TrimRight(q.Name, ".") + if fakePool.LookupHost(host) { + return next(r) + } + if q.Qtype == D.TypeAAAA { msg := &D.Msg{} msg.Answer = []D.RR{} @@ -115,11 +120,6 @@ func withFakeIP(fakePool *fakeip.Pool) middleware { return next(r) } - host := strings.TrimRight(q.Name, ".") - if fakePool.LookupHost(host) { - return next(r) - } - rr := &D.A{} rr.Hdr = D.RR_Header{Name: q.Name, Rrtype: D.TypeA, Class: D.ClassINET, Ttl: dnsDefaultTTL} ip := fakePool.Lookup(host)