Skip to content

Commit

Permalink
Fix: the priority of fake-ip-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamacro committed Oct 8, 2020
1 parent 4859b15 commit d3b14c3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dns/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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)
Expand Down

0 comments on commit d3b14c3

Please sign in to comment.