netns

package
v0.0.0-...-c34bea4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package netns contains various utility functions to work with network namespaces

Index

Constants

View Source
const SO_NETNS_COOKIE = 71

Variables

This section is empty.

Functions

func GetNetNSCookie

func GetNetNSCookie() (uint64, error)

GetNetNSCookie tries to retrieve the cookie of the host netns.

func ListNamedNetNSWithPrefix

func ListNamedNetNSWithPrefix(prefix string) ([]string, error)

ListNamedNetNSWithPrefix returns list of named network namespaces which name starts with the given prefix.

func RemoveIfFromNetNSIfExists

func RemoveIfFromNetNSIfExists(netNS ns.NetNS, ifName string) error

RemoveIfFromNetNSIfExists removes the given interface from the given network namespace.

If the interface does not exist, no error will be returned.

func RemoveIfFromNetNSWithNameIfBothExist

func RemoveIfFromNetNSWithNameIfBothExist(netNSName, ifName string) error

RemoveIfFromNetNSWithNameIfBothExist removes the given interface from the given network namespace identified by its name.

If either the interface or the namespace do not exist, no error will be returned.

func RemoveNetNSWithName

func RemoveNetNSWithName(netNSName string) error

RemoveNetNSWithName removes the given named network namespace.

FIXME: replace "ip-netns" invocations with native Go code

func ReplaceNetNSWithName

func ReplaceNetNSWithName(netNSName string) (ns.NetNS, error)

ReplaceNetNSWithName creates a network namespace with the given name. 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.

FIXME: replace "ip-netns" invocations with native Go code

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL