1
0
Fork 0
forked from External/ergo

add more logging

This commit is contained in:
Jeremy Latt 2014-02-13 18:59:45 -08:00
parent b6a7d98b64
commit b8bbc7eeb5
3 changed files with 27 additions and 6 deletions

View file

@ -1,6 +1,7 @@
package irc
import (
"log"
"net"
"strings"
)
@ -19,9 +20,17 @@ func AddrLookupHostname(addr net.Addr) string {
}
func LookupHostname(addr string) string {
if DEBUG_NET {
log.Printf("LookupHostname(%s)", addr)
}
names, err := net.LookupAddr(addr)
if err != nil {
return addr
}
return strings.TrimSuffix(names[0], ".")
hostname := strings.TrimSuffix(names[0], ".")
if DEBUG_NET {
log.Printf("LookupHostname(%s) → %s", addr, hostname)
}
return hostname
}