package route
Import Path
vendor/golang.org/x/net/route (on golang.org and 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
d-> route.go
route_classic.go
sys.go
sys_darwin.go
syscall_go1_12_darwin.go
zsys_darwin.go
empty.s
Exported Type Names
type Addr (interface)
An Addr represents an address associated with packet routing.
(T) Family() int
*DefaultAddr
*Inet4Addr
*Inet6Addr
*LinkAddr
type DefaultAddr (struct)
A DefaultAddr represents an address of various operating
system-specific features.
Raw []byte
(*T) Family() int
*T : Addr
type Inet4Addr (struct)
An Inet4Addr represents an internet address for IPv4.
IP [4]byte
(*T) Family() int
*T : Addr
type Inet6Addr (struct)
An Inet6Addr represents an internet address for IPv6.
IP [16]byte
ZoneID int
(*T) Family() int
*T : Addr
type InterfaceAddrMessage (struct)
An InterfaceAddrMessage represents an interface address message.
Addrs []Addr
Flags int
Index int
Type int
Version int
(*T) Sys() []Sys
*T : Message
type InterfaceAnnounceMessage (struct)
An InterfaceAnnounceMessage represents an interface announcement
message.
Index int
Name string
Type int
Version int
What int
(*T) Sys() []Sys
*T : Message
type InterfaceMessage (struct)
An InterfaceMessage represents an interface message.
Addrs []Addr
Flags int
Index int
Name string
Type int
Version int
(*T) Sys() []Sys
*T : Message
type InterfaceMetrics (struct)
InterfaceMetrics represents interface metrics.
MTU int
Type int
(*T) SysType() SysType
*T : Sys
type InterfaceMulticastAddrMessage (struct)
An InterfaceMulticastAddrMessage represents an interface multicast
address message.
Addrs []Addr
Flags int
Index int
Type int
Version int
(*T) Sys() []Sys
*T : Message
type LinkAddr (struct)
A LinkAddr represents a link-layer address.
Addr []byte
Index int
Name string
(*T) Family() int
*T : Addr
type Message (interface)
A Message represents a routing message.
(T) Sys() []Sys
*InterfaceAddrMessage
*InterfaceAnnounceMessage
*InterfaceMessage
*InterfaceMulticastAddrMessage
*RouteMessage
func ParseRIB(typ RIBType, b []byte) ([]Message, error)
type RIBType int
A RIBType represents a type of routing information base.
func FetchRIB(af int, typ RIBType, arg int) ([]byte, error)
func ParseRIB(typ RIBType, b []byte) ([]Message, error)
const RIBTypeInterface
const RIBTypeRoute
type RouteMessage (struct)
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.
Addrs []Addr
Err error
Flags int
ID uintptr
Index int
Seq int
Type int
Version int
(*T) Marshal() ([]byte, error)
(*T) Sys() []Sys
*T : Message
type RouteMetrics (struct)
RouteMetrics represents route metrics.
PathMTU int
(*T) SysType() SysType
*T : Sys
type Sys (interface)
A Sys reprensents operating system-specific information.
(T) SysType() SysType
*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
type SysType int
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
Exported Values
func FetchRIB(af int, typ RIBType, arg int) ([]byte, error)
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.
func ParseRIB(typ RIBType, b []byte) ([]Message, error)
ParseRIB parses b as a routing information base and returns a list
of routing messages.
const RIBTypeInterface RIBType = 3
const RIBTypeRoute RIBType = 1
const SysMetrics SysType = 0
![]() |
The pages are generated with Golds v0.1.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project and 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. |