Skip to content

Commit

Permalink
fix: leak dns when domain in hosts list
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyxim committed Jun 11, 2022
1 parent a5acd3a commit 7d04904
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dns/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ func withHosts(hosts *trie.DomainTrie[netip.Addr], mapping *cache.LruCache[netip
rr.A = ip.AsSlice()

msg.Answer = []D.RR{rr}
} else if ip.Is6() && q.Qtype == D.TypeAAAA {
} else if q.Qtype == D.TypeAAAA {
rr := &D.AAAA{}
rr.Hdr = D.RR_Header{Name: q.Name, Rrtype: D.TypeAAAA, Class: D.ClassINET, Ttl: 10}
rr.AAAA = ip.AsSlice()

ip := ip.As16()
rr.AAAA = ip[:]
msg.Answer = []D.RR{rr}
} else {
return next(ctx, r)
Expand Down

0 comments on commit 7d04904

Please sign in to comment.