YTSFlix_Go/vendor/github.com/anacrolix/missinggo/hostport.go
2018-11-04 15:58:15 +01:00

20 lines
309 B
Go

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
}