From 0f02426796d02512c35533b46e2ef099e4a52c5f Mon Sep 17 00:00:00 2001 From: sigil-03 Date: Tue, 5 May 2026 13:50:20 -0600 Subject: [PATCH] fix host string parsing to fix ipv6 wildcards --- internal/util/network.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/util/network.go b/internal/util/network.go index 83967df..ea504e0 100644 --- a/internal/util/network.go +++ b/internal/util/network.go @@ -50,9 +50,11 @@ func NormaliseBaseURL(baseURL string) string { return baseURL } -// IsPortAvailable checks if a port is available by attempting to bind to it +// IsPortAvailable checks if a port is available by attempting to bind to it. +// Strips brackets from IPv6 addresses since net.JoinHostPort adds them. func IsPortAvailable(host string, port int) bool { - listener, err := (&net.ListenConfig{}).Listen(context.Background(), "tcp", net.JoinHostPort(host, strconv.Itoa(port))) + ipStr := strings.Trim(host, "[]") + listener, err := (&net.ListenConfig{}).Listen(context.Background(), "tcp", net.JoinHostPort(ipStr, strconv.Itoa(port))) if err != nil { return false }