Feature: add fake-ip-filter

This commit is contained in:
Dreamacro
2019-12-28 00:10:06 +08:00
parent 37603735bd
commit 96f490f84a
4 changed files with 31 additions and 2 deletions

View File

@ -26,6 +26,10 @@ func withFakeIP(fakePool *fakeip.Pool) middleware {
}
host := strings.TrimRight(q.Name, ".")
if fakePool.LookupHost(host) {
next(w, r)
return
}
rr := &D.A{}
rr.Hdr = D.RR_Header{Name: q.Name, Rrtype: D.TypeA, Class: D.ClassINET, Ttl: dnsDefaultTTL}