Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoIP = fmt.Errorf("could not find IP matching provided kind")
ErrNoIP indicates that the library could not obtain an IP matching the provided kind.
Functions ¶
func FindDefaultIP ¶
func FindDefaultIP(kind NetRouteKind) (*netip.Addr, error)
FindDefaultIP attempts to find an IP of given NetRouteKind that's most likely connected to wider network. Returns ErrNoIP in case no IP with the given kind can be detected.
Types ¶
type ErrCantParse ¶
type ErrCantParse struct{}
ErrCantParse is returned if the route table is garbage.
func (*ErrCantParse) Error ¶
func (*ErrCantParse) Error() string
type ErrInvalidRouteFileFormat ¶
type ErrInvalidRouteFileFormat struct {
// contains filtered or unexported fields
}
ErrInvalidRouteFileFormat is returned if the format of /proc/net/route is unexpected on Linux systems. Please raise an issue.
func (*ErrInvalidRouteFileFormat) Error ¶
func (e *ErrInvalidRouteFileFormat) Error() string
type ErrNotImplemented ¶
type ErrNotImplemented struct{}
ErrNotImplemented is returned if your operating system is not supported by this package. Please raise an issue to request support.
func (*ErrNotImplemented) Error ¶
func (*ErrNotImplemented) Error() string
type NetRoute ¶
type NetRouteKind ¶
type NetRouteKind uint8
const ( NetRouteKindV4 NetRouteKind = iota + 1 NetRouteKindV6 )
func (NetRouteKind) String ¶
func (n NetRouteKind) String() string
type NetRouteList ¶
type NetRouteList []NetRoute
func FindRoutes ¶
func FindRoutes() (NetRouteList, error)
FindRoutes returns a list of detected routes to default gateways
func (NetRouteList) FindDefaults ¶
func (n NetRouteList) FindDefaults(kind NetRouteKind) []NetRoute
Click to show internal directories.
Click to hide internal directories.