mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-09 01:48:10 -07:00
add more logging
This commit is contained in:
+10
-1
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user