YTSFlix_Go/vendor/github.com/anacrolix/missinggo/hostport.go

20 lines
309 B
Go
Raw Normal View History

2018-11-04 14:58:15 +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
}