ns

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create() (netns.NsHandle, error)

NsCreate returns a handle to a new network namespace. NsEnter must be used to safely enter and exit the new namespace.

func Enter

func Enter(ns netns.NsHandle) (func() error, error)

NsEnter locks the current goroutine the OS thread and switches to a new network namespace. The returned function must be called in order to restore the previous state and unlock the thread.

Types

type Cmd

type Cmd struct {
	*exec.ExecCmd
	NsHandle netns.NsHandle
}

func Command

func Command(ns netns.NsHandle, name string, arg ...string) *Cmd

func (*Cmd) CombinedOutput

func (cmd *Cmd) CombinedOutput() ([]byte, error)

func (*Cmd) Output

func (cmd *Cmd) Output() ([]byte, error)

func (*Cmd) Run

func (cmd *Cmd) Run() error

func (*Cmd) Start

func (cmd *Cmd) Start() error

Jump to

Keyboard shortcuts

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