dnsforward -- give only ip address to querylog, without port

This commit is contained in:
Eugene Bujak 2018-12-05 14:22:09 +03:00
parent 9b43e07d7f
commit b0149972cc
1 changed files with 5 additions and 1 deletions

View File

@ -472,7 +472,11 @@ func (s *Server) handlePacket(p []byte, addr net.Addr, conn *net.UDPConn) {
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, addr.String(), upstreamAddr)
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
}
logRequest(msg, reply, result, elapsed, host, upstreamAddr)
}
//