8 // Extracts the port as an integer from an address string.
9 func AddrPort(addr net.Addr) int {
10 switch raw := addr.(type) {
14 _, port, err := net.SplitHostPort(addr.String())
18 i64, err := strconv.ParseInt(port, 0, 0)
26 func AddrIP(addr net.Addr) net.IP {
27 switch raw := addr.(type) {
33 host, _, err := net.SplitHostPort(addr.String())
37 return net.ParseIP(host)