modulepackage
0.0.0-20180324113139-00d1c24e6261
Repository: https://github.com/spcomb/mdlayher-netlink.git
Documentation: pkg.go.dev
# README
netlink

Package netlink
provides low-level access to Linux netlink sockets.
MIT Licensed.
For more information about how netlink works, check out my blog series on Linux, Netlink, and Go.
If you're looking for package genetlink
, it's been moved to its own
repository at github.com/mdlayher/genetlink
.
Why?
A number of netlink packages are already available for Go, but I wasn't able to find one that aligned with what I wanted in a netlink package:
- Simple, idiomatic API
- Well tested
- Well documented
- Makes use of Go best practices
- Doesn't need root to work
My goal for this package is to use it as a building block for the creation of other netlink family packages.
# Functions
Dial dials a connection to netlink, using the specified netlink family.
MarshalAttributes packs a slice of Attributes into a single byte slice.
NewConn creates a Conn using the specified Socket and PID for netlink communications.
UnmarshalAttributes unpacks a slice of Attributes from a single byte slice.
Validate validates one or more reply Messages against a request Message, ensuring that they contain matching sequence numbers and PIDs.
# Constants
HeaderFlagsAcknowledge requests that netlink reply with an acknowledgement using HeaderTypeError and, if needed, an error code.
HeaderFlagsAppend indicates request adds to the end of the object list.
HeaderFlagsAtomic requests that netlink send an atomic snapshot of its entries.
HeaderFlagsCreate indicates request creates an object if it doesn't already exist.
HeaderFlagsDump requests that netlink return a complete list of all entries.
HeaderFlagsDumpFiltered indicates that a dump was filtered as requested.
HeaderFlagsDumpInterrupted indicates that a dump was inconsistent due to a sequence change.
HeaderFlagsEcho requests that netlink echo this request back to the sender.
HeaderFlagsExcl indicates request does not replace the object if it already exists.
HeaderFlagsMatch requests that netlink return a list of all matching entries.
HeaderFlagsMulti indicates a multi-part message, terminated by HeaderTypeDone on the last message.
HeaderFlagsReplace indicates request replaces an existing matching object.
HeaderFlagsRequest indicates a request to netlink.
HeaderFlagsRoot requests that netlink return a complete table instead of a single entry.
HeaderTypeDone indicates the end of a multi-part message.
HeaderTypeError indicates an error code is present, which is also used to indicate success when the code is 0.
HeaderTypeNoop indicates that no action was taken.
HeaderTypeOverrun indicates that data was lost from this message.
# Interfaces
A Socket is an operating-system specific implementation of netlink sockets used by Conn.
# Type aliases
HeaderFlags specify flags which may be present in a Header.
HeaderType specifies the type of a Header.