Documentation ¶
Overview ¶
Package netutil provides helper functions for network.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdvertisableIPs ¶
AdvertisableIPs returns a slice of global unicast IPs.
func GetListenerAddrs ¶
GetListenerAddrs returns ip address of given net.Listener. If the net.Listener is not TCP listener, GetListenerAddrs returns errNotSupportedNetwork. Returned addresses are sorted that advertisable address comes first.
Types ¶
type StoppableListener ¶
type StoppableListener struct { *net.TCPListener // contains filtered or unexported fields }
func NewStoppableListener ¶
func NewStoppableListener(ctx context.Context, addr string) (*StoppableListener, error)
Click to show internal directories.
Click to hide internal directories.