interpret local ips as localhost

This commit is contained in:
Jeremy Latt 2014-02-09 15:14:53 -08:00
parent 133b91b9f0
commit 6653b55416
1 changed files with 4 additions and 0 deletions

View File

@ -71,6 +71,10 @@ func LookupHostname(addr net.Addr) string {
if err != nil { if err != nil {
return addrStr return addrStr
} }
switch ipaddr {
case "127.0.0.1", "::1":
return "localhost"
}
names, err := net.LookupHost(ipaddr) names, err := net.LookupHost(ipaddr)
if err != nil { if err != nil {
return ipaddr return ipaddr