status-go/vendor/github.com/anacrolix/missinggo/v2/hostport.go

20 lines
309 B
Go
Raw Normal View History

2022-03-10 09:44:48 +00:00
package missinggo
import (
"net"
"strconv"
)
func ParseHostPort(hostport string) (host string, port int, err error) {
host, portStr, err := net.SplitHostPort(hostport)
if err != nil {
return
}
port64, err := strconv.ParseInt(portStr, 0, 0)
if err != nil {
return
}
port = int(port64)
return
}