routetable
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package routetable provides functions that operate on the system's routetable.
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeRouteDestination¶
RouteDestination is the destination of a route.
This is similar to net/netip.Prefix, but also contains an optional IPv6zone.
func (RouteDestination)String¶
func (rRouteDestination) String()string
typeRouteEntry¶
type RouteEntry struct {// Family is the IP family of the route; it will be either 4 or 6.Familyint// Type is the type of this route.TypeRouteType// Dst is the destination of the route.DstRouteDestination// Gatewayis the gateway address specified for this route.// This value will be invalid (where !r.Gateway.IsValid()) in cases// where there is no gateway address for this route.Gatewaynetip.Addr// Interface is the name of the network interface to use when sending// packets that match this route. This field can be empty.Interfacestring// Sys contains platform-specific information about this route.Sysany}RouteEntry contains common cross-platform fields describing an entry in thesystem route table.
funcGet¶
func Get(maxint) ([]RouteEntry,error)
Get returns route entries from the system route table, limited to at mostmax results.
typeRouteEntryLinux¶
type RouteEntryLinux struct {// Type is the raw type of the route.Typeint// Table is the routing table index of this route.Tableint// Src is the source of the route (if any).Srcnetip.Addr// Proto describes the source of the route--i.e. what caused this route// to be added to the route table.Protonetlink.RouteProtocol// Priority is the route's priority.Priorityint// Scope is the route's scope.Scopeint// InputInterfaceIdx is the input interface index.InputInterfaceIdxint// InputInterfaceName is the input interface name (if available).InputInterfaceNamestring}RouteEntryLinux is the structure that makes up the Sys field of theRouteEntry structure.
func (RouteEntryLinux)Format¶
func (rRouteEntryLinux) Format(ffmt.State, verbrune)
Format implements the fmt.Formatter interface.
func (RouteEntryLinux)ScopeName¶
func (rRouteEntryLinux) ScopeName()string
ScopeName returns the string representation of this route's Scope.
func (RouteEntryLinux)TableName¶
func (rRouteEntryLinux) TableName()string
TableName returns the string representation of this route's Table.
func (RouteEntryLinux)TypeName¶
func (rRouteEntryLinux) TypeName()string
TypeName returns the string representation of this route's Type.
typeRouteType¶
type RouteTypeint
RouteType describes the type of a route.
const (// RouteTypeUnspecified is the unspecified route type.RouteTypeUnspecifiedRouteType =iota// RouteTypeLocal indicates that the destination of this route is an// address that belongs to this system.RouteTypeLocal// RouteTypeUnicast indicates that the destination of this route is a// "regular" address--one that neither belongs to this host, nor is a// broadcast/multicast/etc. address.RouteTypeUnicast// RouteTypeBroadcast indicates that the destination of this route is a// broadcast address.RouteTypeBroadcast// RouteTypeMulticast indicates that the destination of this route is a// multicast address.RouteTypeMulticast// RouteTypeOther indicates that the route is of some other valid type;// see the Sys field for the OS-provided route information to determine// the exact type.RouteTypeOther)