Skip to content

raboof/netlink

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

netlink - a simple netlink library for go

Build Status GoDoc

what's netlink ?

The netlink package provides a simple netlink library for go. Netlink is the interface a user-space program in linux uses to communicate with the kernel.

more information here

example

func (c *ExecCollector) prepareSocket() (*netlink.NetlinkSocket, error) {
	ns, err := netlink.NewNetlinkSocket(netlink.CONNECTOR, netlink.CN_IDX_PROC)
	if err != nil {
		return nil, fmt.Errorf("create netlink socket: %v", err)
	}
	req := netlink.NewNetlinkRequest()
	{
		msg := netlink.NewCnMsg()
		req.AddData(msg)
		op := netlink.PROC_CN_MCAST_LISTEN
		req.AddData(&op)
	}
	err = ns.Send(req)
	if err != nil {
		return nil, fmt.Errorf("Exec: %v", err)
	}
	go func() {
		<-c.shutdown
		ns.Close()
	}()
	return ns, nil
}

future work

WIP

About

netlink lib for golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%