mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-02-18 18:28:18 -05:00
proxy/utils: Use net.JoinHostPort to format address.
This commit is contained in:
parent
4811b20170
commit
bbbc09fb11
1 changed files with 2 additions and 4 deletions
|
|
@ -19,6 +19,7 @@ package util
|
|||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -169,10 +170,7 @@ func AppendPortIfNeeded(addr string, port int32) string {
|
|||
}
|
||||
|
||||
// Append port to address.
|
||||
if ip.To4() != nil {
|
||||
return fmt.Sprintf("%s:%d", addr, port)
|
||||
}
|
||||
return fmt.Sprintf("[%s]:%d", addr, port)
|
||||
return net.JoinHostPort(addr, strconv.Itoa(int(port)))
|
||||
}
|
||||
|
||||
// EnsureSysctl sets a kernel sysctl to a given numeric value.
|
||||
|
|
|
|||
Loading…
Reference in a new issue