Fix: the priority of fake-ip-filter

This commit is contained in:
Dreamacro 2020-10-09 00:04:24 +08:00
parent 4859b158b4
commit d3b14c325f

View file

@ -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)