Documentation
¶
Index ¶
- Constants
- Variables
- type AddrEntry
- type AddrFlag
- type AddrFlagData
- type AddrFlagV6
- type AddrScope
- type Client
- func (c *Client) ListAddresses() (map[int][]*AddrEntry, error)
- func (c *Client) ListLinks() ([]*LinkEntry, error)
- func (c *Client) ListNeighbours() ([]*NeighEntry, error)
- func (c *Client) ListRoutes() ([]*RouteEntry, error)
- func (c *Client) ListRoutesV4() ([]*RouteEntry, error)
- func (c *Client) ListRoutesV6() ([]*RouteEntry, error)
- type LinkEntry
- type LinkFlags
- type LinkGroup
- type LinkMode
- type LinkOperState
- type LinkRxErrors
- type LinkStat
- type LinkTxErrors
- type LinkType
- type NeighEntry
- type RouteEntry
- type RouteFlags
- type RoutePref
- type RouteProtocol
- type RouteScope
- type RouteTable
- type RouteType
Constants ¶
const ( ICMPV6_ROUTER_PREF_LOW = 0x3 ICMPV6_ROUTER_PREF_MEDIUM = 0x0 ICMPV6_ROUTER_PREF_HIGH = 0x1 ICMPV6_ROUTER_PREF_INVALID = 0x2 )
const (
RTM_F_OFFLOAD_FAILED = 0x20000000 /* route offload failed, this value
* is chosen to avoid conflicts with
* other flags defined in
* include/uapi/linux/ipv6_route.h
*/
)
Variables ¶
var AddrFlagDatas []AddrFlagData
Functions ¶
This section is empty.
Types ¶
type AddrFlagV6 ¶
type AddrFlagV6 int
func (AddrFlagV6) String ¶
func (f AddrFlagV6) String() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client can manipulate ip netlink interface.
func NewWithConn ¶
NewWithConn creates a Client which can issue ip commands with the given netlink connection.
func (*Client) ListAddresses ¶
ListAddresses gets all addresses information of links from kernel by netlink interface. Firstly, send a getting address request, and receive all netlink response messages. Secondly, parse address information from every netlink response messages one by one.
func (*Client) ListLinks ¶
ListLinks gets all links information from kernel by netlink interface. Firstly, send a getting link request, and receive all netlink response messages. Secondly, parse link information from every netlink response messages one by one.
func (*Client) ListNeighbours ¶
func (c *Client) ListNeighbours() ([]*NeighEntry, error)
ListNeighbours dumps arp table from kernel. Firstly, send a getting neighbour request, and receive all netlink response messages. Secondly, parse neighbour information from every netlink response messages one by one.
func (*Client) ListRoutes ¶
func (c *Client) ListRoutes() ([]*RouteEntry, error)
func (*Client) ListRoutesV4 ¶
func (c *Client) ListRoutesV4() ([]*RouteEntry, error)
func (*Client) ListRoutesV6 ¶
func (c *Client) ListRoutesV6() ([]*RouteEntry, error)
type LinkEntry ¶
type LinkEntry struct {
DeviceType LinkType
DeviceFlags LinkFlags
Ifindex int
Name string
Master int
Link int
Namespace int
TxQueueCount int
TxQueue int
RxQueueCount int
MTU int
MinMTU int
MaxMTU int
OperState LinkOperState
Mode LinkMode
Group LinkGroup
Promiscuity int
MaxGSOSegs int
MaxGSOSize int
Carrier uint8
CarrierChanges int
CarrierUpCount int
CarrierDownCount int
QDisc string
ProtoDown uint8
Map []byte
Addr []byte
Broadcast []byte
Stat []byte
Stat64 []byte
XDP uint64
AFSpec []byte
}
A LinkEntry contains information for the link from kernel, like ifindex, name, link state, link type and so on. It should includes all information from executing command `ip link list`.
type LinkOperState ¶
type LinkOperState int
LinkOperState is the type of link operstate.
func (LinkOperState) String ¶
func (s LinkOperState) String() string
String returns the string description of the LinkOperState.
type LinkRxErrors ¶
type LinkRxErrors struct {
Length uint64
RingBufferOverflow uint64
CRC uint64
FrameAlign uint64
FifoOverrun uint64
MissedPacket uint64
}
LinkRxErrors is the rx error statistics of the link.
type LinkStat ¶
type LinkStat struct {
RxPackets uint64
TxPackets uint64
RxBytes uint64
TxBytes uint64
RxErrors uint64
TxErrors uint64
RxDropped uint64
TxDropped uint64
MulticastRx uint64
Collisions uint64
LinkRxErrors
LinkTxErrors
}
LinkStat is the packet statistis of the link, including rx error statistics and tx error statistics.
func (*LinkStat) UnmarshalBinary ¶
UnmarshalBinary gets a LinkStat from a byte slice.
type LinkTxErrors ¶
LinkTxErrors is the tx error statistics of the link.
type NeighEntry ¶
A NeighEntry contains information for the arp records from kernel.
type RouteEntry ¶
type RouteEntry struct {
Family int
DstLen int
SrcLen int
Tos int
TableID RouteTable
Protocol RouteProtocol
Scope RouteScope
Type RouteType
Flags RouteFlags
Daddr net.IP
Saddr net.IP
InIfindex int
OutIfindex int
Gateway net.IP
Table RouteTable
Priority int
PrefSrc net.IP
Metric int
Pref RoutePref
}
type RouteFlags ¶
type RouteFlags int
func (RouteFlags) String ¶
func (f RouteFlags) String() string
type RouteProtocol ¶
type RouteProtocol int
func (RouteProtocol) String ¶
func (p RouteProtocol) String() string
type RouteScope ¶
type RouteScope int
func (RouteScope) String ¶
func (s RouteScope) String() string
type RouteTable ¶
type RouteTable int
func (RouteTable) String ¶
func (t RouteTable) String() string