From 859d0cd607e89ed444dbe846e4490c2dc88dbb82 Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Sun, 16 Oct 2016 14:17:29 +1000 Subject: [PATCH] net: Prepend IPv6 addresses with '0' if necessary --- irc/net.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/irc/net.go b/irc/net.go index a6c96f15..264849b3 100644 --- a/irc/net.go +++ b/irc/net.go @@ -28,7 +28,11 @@ func AddrLookupHostname(addr net.Addr) string { func LookupHostname(addr string) string { names, err := net.LookupAddr(addr) if err != nil || len(names) < 1 || !IsHostname(names[0]) { - // return original address + // return original address if no hostname found + if len(addr) > 0 && addr[0] == ':' { + // fix for IPv6 hostnames (so they don't start with a colon), same as all other IRCds + addr = "0" + addr + } return addr }