bugfix: better parsing of client IP for query log

pull/1/head
Adam Veldhousen 2021-06-10 10:50:35 -05:00
parent 03ccb0c08c
commit 9320c2675a
Signed by: adam
GPG Key ID: 6DB29003C6DD1E4B
1 changed files with 2 additions and 1 deletions

View File

@ -20,10 +20,11 @@ func (dm *DomainManager) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
start := time.Now()
q := r.Question[0]
responseMessage := new(dns.Msg)
ql := QueryLog{
Started: start.UTC(),
Protocol: w.RemoteAddr().Network(),
ClientIP: strings.Split(w.RemoteAddr().String(), ":")[0],
ClientIP: w.RemoteAddr().String()[:strings.LastIndex(w.RemoteAddr().String(), ":")],
Domain: q.Name,
Status: NoAnswer,
}