From 963c0e0f3299ce47fc44cda8b9dead59ff7eea2b Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sat, 27 May 2023 20:36:17 +1000 Subject: [PATCH 1/1] Fix addrPortOrZero for unix sockets on Windows --- ipport.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) } -- 2.44.0