forked from External/ergo
add more logging
This commit is contained in:
parent
b6a7d98b64
commit
b8bbc7eeb5
3 changed files with 27 additions and 6 deletions
11
irc/net.go
11
irc/net.go
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue