From cd4e7e51a7ad062e67223d9bcf108b039f915f6a Mon Sep 17 00:00:00 2001 From: Naman Sood Date: Wed, 21 Apr 2021 14:44:07 -0400 Subject: [PATCH] use net.JoinHostPort Signed-off-by: Naman Sood --- wgengine/netstack/netstack.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wgengine/netstack/netstack.go b/wgengine/netstack/netstack.go index 1fe70134b..47c934b38 100644 --- a/wgengine/netstack/netstack.go +++ b/wgengine/netstack/netstack.go @@ -566,5 +566,7 @@ func startPacketCopy(ctx context.Context, cancel context.CancelFunc, dst net.Pac } func stringifyTEI(tei stack.TransportEndpointID) string { - return fmt.Sprintf("%s:%v -> %s:%v", tei.LocalAddress, tei.LocalPort, tei.RemoteAddress, tei.RemotePort) + localHostPort := net.JoinHostPort(tei.LocalAddress.String(), strconv.Itoa(int(tei.LocalPort))) + remoteHostPort := net.JoinHostPort(tei.RemoteAddress.String(), strconv.Itoa(int(tei.RemotePort))) + return fmt.Sprintf("%s -> %s", remoteHostPort, localHostPort) }