Documentation ¶
Overview ¶
Package netns contains various utility functions to work with network namespaces
Index ¶
Constants ¶
const SO_NETNS_COOKIE = 71
Variables ¶
This section is empty.
Functions ¶
func GetNetNSCookie ¶
GetNetNSCookie tries to retrieve the cookie of the host netns.
func ListNamedNetNSWithPrefix ¶
ListNamedNetNSWithPrefix returns list of named network namespaces which name starts with the given prefix.
func RemoveIfFromNetNSIfExists ¶
RemoveIfFromNetNSIfExists removes the given interface from the given network namespace.
If the interface does not exist, no error will be returned.
func RemoveNetNSWithName ¶
RemoveNetNSWithName removes the given named network namespace.
FIXME: replace "ip-netns" invocations with native Go code
func ReplaceNetNSWithName ¶
ReplaceNetNSWithName creates a network namespace with the given name and returns a handle to it. If such netns already exists from a previous run, it will be removed and then re-created to avoid any previous state of the netns.
Example usage of this function:
netns0, err := netns.ReplaceNetNSWithName(netnsName) if err != nil { return err } defer netns.RemoveNetNSWithName(netnsName) netns0.Do(func(_ ns.NetNS) error { <logic to be executed within the new netns> })
FIXME: replace "ip-netns" invocations with native Go code
Types ¶
This section is empty.