Documentation ¶
Index ¶
Constants ¶
View Source
const ( // NetlinkRoute return socket descriptor. NetlinkRoute = 0 // RtmGrpLink Rtnetlink multicast group. RtmGrpLink = 0x1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { Family int Groups uint32 FileDescr int SocketAddr *unix.SockaddrNetlink Pid uint32 }
Conn provides an interface for connecting to netlink socket.
type Flags ¶
type Flags uint
Flags type for network interface state.
const ( // FlagUp interface is up (administratively). FlagUp Flags = 1 << iota // FlagBroadcast broadcast address valid. FlagBroadcast // FlagDebug turn on debugging. FlagDebug // FlagLoopback is a loopback net. FlagLoopback // FlagPointToPoint interface is has p-p link. FlagPointToPoint // FlagNoTrailers avoid use of trailers. FlagNoTrailers // FlagRunning interface RFC2863 OPER_UP. FlagRunning // FlagNoArp no ARP protocol. FlagNoArp // FlagPromisc receive all packets. FlagPromisc // FlagAllMulti receive all multicast packets. FlagAllMulti // FlagMaster master of a load balancer. FlagMaster // FlagSlave slave of a load balancer. FlagSlave // FlagMulticast supports multicast. FlagMulticast // FlagPortSel can set media type. FlagPortSel // FlagAutoMedia auto media select active. FlagAutoMedia // FlagDynamic dialup device with changing addresses. FlagDynamic // FlagLowerUp driver signals L1 up. FlagLowerUp // FlagDormant driver signals dormant. FlagDormant // FlagEcho echo sent packets. FlagEcho )
func (Flags) MarshalJSON ¶
MarshalJSON marshal flags into JSON.
type HwAddr ¶
type HwAddr []byte
HwAddr hardware address type.
func (HwAddr) MarshalJSON ¶
MarshalJSON marshal hardware address into JSON.
type Interface ¶
type Interface struct { Index int `json:"index"` MTU int `json:"mtu"` Name string `json:"name"` HwAddr HwAddr `json:"hwaddr,omitempty"` Flags Flags `json:"flags"` NetInterface *net.Interface `json:"-"` }
Interface provides information about a network interface.
func Interfaces ¶
Interfaces connect using rtnetlink and retrieve all network interfaces.
func ParseNewLink ¶
func ParseNewLink(ifim *syscall.IfInfomsg, attrs []syscall.NetlinkRouteAttr) *Interface
ParseNewLink parse interface info message.
Click to show internal directories.
Click to hide internal directories.