Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDelAddr ¶
func IsDelAddr(msg *syscall.NetlinkMessage) bool
IsDelAddr checking message type for syscall.RTM_RTM_DELADDRNEWADDR
func IsNewAddr ¶
func IsNewAddr(msg *syscall.NetlinkMessage) bool
IsNewAddr checking message type for syscall.RTM_NEWADDR
Types ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener provides possibility to listen for a netlink messages
Usage example:
l, err := CreateListener() if err != nil { fmt.Println("Failed to initialize netlink listener: %s", err) return } for { msgs, err := l.ReadMsgs() if err != nil { fmt.Println("Could not read netlink messages: %s", err) } for _, m := range msgs { if IsNewAddr(&m) || IsDelAddr(&m) { fmt.Println("Address changed") } } }
func CreateListener ¶
CreateListener creates new NetlinkListener object
Click to show internal directories.
Click to hide internal directories.