20 lines
315 B
Go
Raw Normal View History

2022-03-10 10:44:48 +01:00
package missinggo
import (
"net"
"strconv"
)
type IpPort struct {
IP net.IP
Port uint16
}
func (me IpPort) String() string {
return net.JoinHostPort(me.IP.String(), strconv.FormatUint(uint64(me.Port), 10))
}
func IpPortFromNetAddr(na net.Addr) IpPort {
return IpPort{AddrIP(na), uint16(AddrPort(na))}
}