diff --git a/pkg/net/http/blademaster/metadata.go b/pkg/net/http/blademaster/metadata.go index fc294a3d3..5befddd5f 100644 --- a/pkg/net/http/blademaster/metadata.go +++ b/pkg/net/http/blademaster/metadata.go @@ -2,6 +2,7 @@ package blademaster import ( "fmt" + "net" "net/http" "strconv" "strings" @@ -110,7 +111,7 @@ func remoteIP(req *http.Request) (remote string) { if remote = req.Header.Get("X-Real-IP"); remote != "" { return } - remote = req.RemoteAddr[:strings.Index(req.RemoteAddr, ":")] + remote, _, _ = net.SplitHostPort(req.RemoteAddr) return }