From ccfcccfef65dc7be6bd591ded811e05e86ef8ae8 Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Thu, 26 Dec 2019 16:23:37 +0100 Subject: Merge multi-answer log entries --- http/http.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'http/http.go') diff --git a/http/http.go b/http/http.go index 2b0c5cc..dac035c 100644 --- a/http/http.go +++ b/http/http.go @@ -19,11 +19,11 @@ type Server struct { } type logEntry struct { - Time string `json:"time"` - RemoteAddr net.IP `json:"remote_addr"` - Qtype string `json:"type"` - Question string `json:"question"` - Answer string `json:"answer"` + Time string `json:"time"` + RemoteAddr net.IP `json:"remote_addr"` + Qtype string `json:"type"` + Question string `json:"question"` + Answers []string `json:"answers"` } type httpError struct { @@ -101,13 +101,15 @@ func (s *Server) logHandler(w http.ResponseWriter, r *http.Request) (interface{} dnsType = "A" case dns.TypeAAAA: dnsType = "AAAA" + case dns.TypeMX: + dnsType = "MX" } e := logEntry{ Time: entry.Time.UTC().Format(time.RFC3339), RemoteAddr: entry.RemoteAddr, Qtype: dnsType, Question: entry.Question, - Answer: entry.Answer, + Answers: entry.Answers, } entries = append(entries, e) } -- cgit v1.2.3