ns

package
v0.0.0-...-a9890c3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetNS

type NetNS struct {
	// contains filtered or unexported fields
}

NetNS allows communicating with a network namespace

func CreateNetNS

func CreateNetNS(name string) (*NetNS, error)

CreateNetNS creates a new network namespace and sets a name

func (*NetNS) Close

func (n *NetNS) Close() error

Close unbinds and closes the netns

func (*NetNS) Exec

func (n *NetNS) Exec(fn func() error) error

Exec switches to the specified netns and executes the closure WARNING: CANNOT EXECUTE WITH GOROUTINES _INSIDE_ THE CLOSURE

func (*NetNS) Fd

func (n *NetNS) Fd() int

Fd provides the file decriptor of the namespace

func (*NetNS) SetNSName

func (n *NetNS) SetNSName(name string) error

SetNSName sets a name for the netns which can be accessible via 'ip netns' commands

func (*NetNS) Unbind

func (n *NetNS) Unbind() error

Unbind removes the mount created from setNSName

Jump to

Keyboard shortcuts

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