From: Matt Joiner Date: Sat, 27 May 2023 10:36:17 +0000 (+1000) Subject: Fix addrPortOrZero for unix sockets on Windows X-Git-Url: http://www.git.stargrave.org/?p=btrtrc.git;a=commitdiff_plain;h=963c0e0f3299ce47fc44cda8b9dead59ff7eea2b Fix addrPortOrZero for unix sockets on Windows --- diff --git a/ipport.go b/ipport.go index 9fe9e42d..a85a97fc 100644 --- a/ipport.go +++ b/ipport.go @@ -13,13 +13,14 @@ func addrPortOrZero(addr net.Addr) int { case *net.TCPAddr: return raw.Port default: + // Consider a unix socket on Windows with a name like "C:notanint". _, port, err := net.SplitHostPort(addr.String()) if err != nil { return 0 } i64, err := strconv.ParseUint(port, 0, 16) if err != nil { - panic(err) + return 0 } return int(i64) }