Fix #706 -- rDNS for DOH/DOT clients

This commit is contained in:
Andrey Meshkov
2019-06-04 20:38:53 +03:00
parent 3454bf9243
commit a3b8d4d923
4 changed files with 29 additions and 16 deletions

14
dns.go
View File

@@ -154,10 +154,18 @@ func asyncRDNSLoop() {
}
func onDNSRequest(d *proxy.DNSContext) {
if d.Req.Question[0].Qtype == dns.TypeA {
ip, _, _ := net.SplitHostPort(d.Addr.String())
beginAsyncRDNS(ip)
qType := d.Req.Question[0].Qtype
if qType != dns.TypeA && qType != dns.TypeAAAA {
return
}
ip := dnsforward.GetIPString(d.Addr)
if ip == "" {
// This would be quite weird if we get here
return
}
beginAsyncRDNS(ip)
}
func generateServerConfig() dnsforward.ServerConfig {