Documentation
¶
Overview ¶
Package nltest provides utilities for netlink testing.
Index ¶
Constants ¶
const PID = 1
PID is the netlink header PID value assigned by nltest.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
Dial sets up a netlink.Conn for testing using the specified Func. All requests sent from the connection will be passed to the Func. The connection should be closed as usual when it is no longer needed.
Types ¶
type Func ¶
A Func is a function that can be used to test netlink.Conn interactions. The function can choose to return zero or more netlink messages, or an error if needed.
For a netlink request/response interaction, a request req is populated by netlink.Conn.Send and passed to the function.
For multicast interactions, an empty request req is passed to the function when netlink.Conn.Receive is called.
If a Func returns an error, the error will be returned as-is to the caller. If no messages and io.EOF are returned, no messages and no error will be returned to the caller, simulating a multi-part message with no data.