netlink is a Go library that provides a simple interface for communicating with the Linux kernel through netlink sockets.
The library solves the problem of managing network configuration from user-space Go programs. Netlink is the standard Linux mechanism for user-space applications to communicate with the kernel to add and remove network interfaces, configure IP addresses and routes, and set up IPsec. The library wraps low-level netlink messages with a higher-level API modeled on the iproute2 command-line tool, so operations like adding a link correspond to similarly named functions such as AddLink(). This approach makes netlink communication accessible without requiring developers to construct raw netlink messages. The library originated as a fork of netlink functionality from docker/libcontainer but was substantially rewritten to improve testability, performance, and to add support for IPsec xfrm handling.
Developers should know that netlink operations require elevated privileges and typically must run as root. The library is suitable for infrastructure tools, container runtimes, and network management applications that need to programmatically configure Linux networking from Go. The API design follows iproute2 conventions, making it intuitive for developers familiar with standard Linux networking tools.
The project shows active maintenance with a structured approach to expanding functionality. The README acknowledges that many aspects of netlink are not yet fully supported in the high-level interface, indicating ongoing development to add missing fields and link types. The codebase includes testing infrastructure, though tests require root privileges to run. The library maintains low-level netlink primitives as a foundation, positioning future work as a matter of exposing additional fields through the high-level objects and ensuring proper serialization and deserialization in existing methods.