use net.JoinHostPort instead of fmt.Sprintf (#2791)
This commit is contained in:
1 parent
b2311e55e7
commit
6194273615
17 files changed
+61
-49
No files matched your search
@@ -19,6 +19,7 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
@@ -52,7 +53,7 @@ func CanonicalAddr(host string, port int) (addr string) {
|
||||
if port == 80 || port == 443 {
|
||||
addr = host
|
||||
} else {
|
||||
addr = fmt.Sprintf("%s:%d", host, port)
|
||||
addr = net.JoinHostPort(host, strconv.Itoa(port))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user