use net.JoinHostPort

Signed-off-by: Naman Sood <mail@nsood.in>
naman/netstack-request-logging
Naman Sood 3 years ago
parent 6bb159d5fa
commit cd4e7e51a7

@ -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)
}

Loading…
Cancel
Save