package route
Import Path
vendor/golang.org/x/net/route (on go.dev)
Dependency Relation
imports 5 packages, and imported by one package
Involved Source Files
address.go
binary.go
interface.go
interface_classic.go
interface_multicast.go
message.go
Package route provides basic functions for the manipulation of
packet routing facilities on BSD variants.
The package supports any version of Darwin, any version of
DragonFly BSD, FreeBSD 7 and above, NetBSD 6 and above, and OpenBSD
5.6 and above.
route_classic.go
sys.go
sys_darwin.go
syscall_go1_12_darwin.go
zsys_darwin.go
empty.s
Package-Level Type Names (total 20, in which 16 are exported)
An Addr represents an address associated with packet routing.
Family returns an address family.
*DefaultAddr
*Inet4Addr
*Inet6Addr
*LinkAddr
func parseAddrs(attrs uint, fn func(int, []byte) (int, Addr, error), b []byte) ([]Addr, error)
func parseDefaultAddr(b []byte) (Addr, error)
func parseInetAddr(af int, b []byte) (Addr, error)
func parseKernelInetAddr(af int, b []byte) (int, Addr, error)
func parseKernelLinkAddr(_ int, b []byte) (int, Addr, error)
func parseLinkAddr(b []byte) (Addr, error)
func addrsSpace(as []Addr) int
func marshalAddrs(b []byte, as []Addr) (uint, error)
A DefaultAddr represents an address of various operating
system-specific features.
// raw format of address
af int
Family implements the Family method of Addr interface.
(*T) lenAndSpace() (int, int)
(*T) marshal(b []byte) (int, error)
*T : Addr
An Inet4Addr represents an internet address for IPv4.
// IP address
Family implements the Family method of Addr interface.
(*T) lenAndSpace() (int, int)
(*T) marshal(b []byte) (int, error)
*T : Addr
An Inet6Addr represents an internet address for IPv6.
// IP address
// zone identifier
Family implements the Family method of Addr interface.
(*T) lenAndSpace() (int, int)
(*T) marshal(b []byte) (int, error)
*T : Addr
An InterfaceAddrMessage represents an interface address message.
// addresses
// interface flags
// interface index
// message type
// message version
// raw message
Sys implements the Sys method of Message interface.
*T : Message
An InterfaceAnnounceMessage represents an interface announcement
message.
// interface index
// interface name
// message type
// message version
// what type of announcement
// raw message
Sys implements the Sys method of Message interface.
*T : Message
An InterfaceMessage represents an interface message.
// addresses
// interface flags
// interface index
// interface name
// message type
// message version
// offset of header extension
// raw message
Sys implements the Sys method of Message interface.
*T : Message
InterfaceMetrics represents interface metrics.
// maximum transmission unit
// interface type
SysType implements the SysType method of Sys interface.
*T : Sys
An InterfaceMulticastAddrMessage represents an interface multicast
address message.
// addresses
// interface flags
// interface index
// message type
// message version
// raw message
Sys implements the Sys method of Message interface.
*T : Message
A LinkAddr represents a link-layer address.
// link-layer address when attached
// interface index when attached
// interface name when attached
Family implements the Family method of Addr interface.
(*T) lenAndSpace() (int, int)
(*T) marshal(b []byte) (int, error)
*T : Addr
A Message represents a routing message.
Sys returns operating system-specific information.
*InterfaceAddrMessage
*InterfaceAnnounceMessage
*InterfaceMessage
*InterfaceMulticastAddrMessage
*RouteMessage
func ParseRIB(typ RIBType, b []byte) ([]Message, error)
func net.interfaceMessages(ifindex int) ([]Message, error)
A RIBType represents a type of routing information base.
( T) parseable() bool
func FetchRIB(af int, typ RIBType, arg int) ([]byte, error)
func ParseRIB(typ RIBType, b []byte) ([]Message, error)
const RIBTypeInterface
const RIBTypeRoute
A RouteMessage represents a message conveying an address prefix, a
nexthop address and an output interface.
Unlike other messages, this message can be used to query adjacency
information for the given address prefix, to add a new route, and
to delete or modify the existing route from the routing information
base inside the kernel by writing and reading route messages on a
routing socket.
For the manipulation of routing information, the route message must
contain appropriate fields that include:
Version = <must be specified>
Type = <must be specified>
Flags = <must be specified>
Index = <must be specified if necessary>
ID = <must be specified>
Seq = <must be specified>
Addrs = <must be specified>
The Type field specifies a type of manipulation, the Flags field
specifies a class of target information and the Addrs field
specifies target information like the following:
route.RouteMessage{
Version: RTM_VERSION,
Type: RTM_GET,
Flags: RTF_UP | RTF_HOST,
ID: uintptr(os.Getpid()),
Seq: 1,
Addrs: []route.Addrs{
RTAX_DST: &route.Inet4Addr{ ... },
RTAX_IFP: &route.LinkAddr{ ... },
RTAX_BRD: &route.Inet4Addr{ ... },
},
}
The values for the above fields depend on the implementation of
each operating system.
The Err field on a response message contains an error value on the
requested operation. If non-nil, the requested operation is failed.
// addresses
// error on requested operation
// route flags
// sender's identifier; usually process ID
// interface index when attached
// sequence number
// message type
// message version
// offset of header extension
// raw message
Marshal returns the binary encoding of m.
Sys implements the Sys method of Message interface.
(*T) marshal() ([]byte, error)
*T : Message
RouteMetrics represents route metrics.
// path maximum transmission unit
SysType implements the SysType method of Sys interface.
*T : Sys
A Sys reprensents operating system-specific information.
SysType returns a type of operating system-specific
information.
*InterfaceMetrics
*RouteMetrics
func (*InterfaceAddrMessage).Sys() []Sys
func (*InterfaceAnnounceMessage).Sys() []Sys
func (*InterfaceMessage).Sys() []Sys
func (*InterfaceMulticastAddrMessage).Sys() []Sys
func Message.Sys() []Sys
func (*RouteMessage).Sys() []Sys
A SysType represents a type of operating system-specific
information.
func (*InterfaceMetrics).SysType() SysType
func (*RouteMetrics).SysType() SysType
func Sys.SysType() SysType
const SysMetrics
const SysStats
Package-Level Functions (total 14, in which 2 are exported)
FetchRIB fetches a routing information base from the operating
system.
The provided af must be an address family.
The provided arg must be a RIBType-specific argument.
When RIBType is related to routes, arg might be a set of route
flags. When RIBType is related to network interfaces, arg might be
an interface index or a set of interface flags. In most cases, zero
means a wildcard.
ParseRIB parses b as a routing information base and returns a list
of routing messages.
Package-Level Variables (total 12, none are exported)
Package-Level Constants (total 79, in which 4 are exported)
const RIBTypeInterface RIBType = 3 const RIBTypeRoute RIBType = 1 const SysMetrics SysType = 0
The pages are generated with Golds v0.4.2. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |