dns: fixed a bug in UnmarshalRR

This commit is contained in:
nadoo committed 2018-07-30 00:18:10 +08:00
1 parent d5e3ea539a
commit 5e32133eb9
2 files changed
+12 -20

No files matched your search

+3 -4
View File
@@ -90,7 +90,7 @@ func (c *Client) Exchange(reqBytes []byte, clientAddr string) (respBytes []byte,
return
}
ip := ""
ips := []string{}
for _, answer := range respM.Answers {
if answer.TYPE == QTypeA {
for _, h := range c.Handlers {
@@ -98,17 +98,16 @@ func (c *Client) Exchange(reqBytes []byte, clientAddr string) (respBytes []byte,
}
if answer.IP != "" {
ip += answer.IP + ","
ips = append(ips, answer.IP)
}
}
log.F("rr: %+v", answer)
}
// add to cache
log.F("[dns] %s <-> %s, type: %d, %s: %s",
clientAddr, dnsServer, reqM.Question.QTYPE, reqM.Question.QNAME, ip)
clientAddr, dnsServer, reqM.Question.QTYPE, reqM.Question.QNAME, strings.Join(ips, ","))
return
}