From 45ac3d899f4082de13f1ce37d8bacd1b0f7f1dda Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 3 May 2023 23:47:24 +0400 Subject: [PATCH] fix: build siderolink endpoint correctly This was breaking for IPv6 addresses. Closes #1116 (This is a better/shorter fix). Signed-off-by: Andrey Smirnov --- app/sidero-controller-manager/cmd/siderolink-manager/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/sidero-controller-manager/cmd/siderolink-manager/main.go b/app/sidero-controller-manager/cmd/siderolink-manager/main.go index 1b7ea058..6ef76c4c 100644 --- a/app/sidero-controller-manager/cmd/siderolink-manager/main.go +++ b/app/sidero-controller-manager/cmd/siderolink-manager/main.go @@ -14,6 +14,7 @@ import ( "net/netip" "os" "os/signal" + "strconv" "syscall" grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" @@ -104,7 +105,7 @@ func run() error { logger.Sugar().Infof("resolved wireguard endpoint %s to %s", wireguardEndpoint, wireguardEndpointIP) } - siderolink.Cfg.WireguardEndpoint = fmt.Sprintf("%s:%d", wireguardEndpointIP, wireguardPort) + siderolink.Cfg.WireguardEndpoint = net.JoinHostPort(wireguardEndpointIP, strconv.Itoa(wireguardPort)) if err = siderolink.Cfg.LoadOrCreate(ctx, metalclient); err != nil { return err