* dnsfilter: change DNS answer for host rules
When matched by a host rule, return only the IP address specified in rule. Respond with an empty IP list to another request type. :: host -- return nothing to A, return :: to AAAA request 0.0.0.0 host -- return 0.0.0.0 to A, return nothing to AAAA request
This commit is contained in:
@@ -788,7 +788,8 @@ func (s *Server) genAAAAAnswer(req *dns.Msg, ip net.IP) *dns.AAAA {
|
||||
func (s *Server) genResponseWithIP(req *dns.Msg, ip net.IP) *dns.Msg {
|
||||
if req.Question[0].Qtype == dns.TypeA && ip.To4() != nil {
|
||||
return s.genARecord(req, ip.To4())
|
||||
} else if req.Question[0].Qtype == dns.TypeAAAA && ip.To4() == nil {
|
||||
} else if req.Question[0].Qtype == dns.TypeAAAA &&
|
||||
len(ip) == net.IPv6len && ip.To4() == nil {
|
||||
return s.genAAAARecord(req, ip)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user