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

20 lines
315 B
Go
Raw Normal View History

2022-03-10 09:44:48 +00: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))}
}