package ns

import "github.com/containernetworking/cni/pkg/ns"

Index

Functions

func SetNS

func SetNS(f *os.File, flags uintptr) error

SetNS sets the network namespace on a target file.

func WithNetNS

func WithNetNS(ns *os.File, lockThread bool, f func(*os.File) error) error

WithNetNS executes the passed closure under the given network namespace, restoring the original namespace afterwards. Changing namespaces must be done on a goroutine that has been locked to an OS thread. If lockThread arg is true, this function locks the goroutine prior to change namespace and unlocks before returning. If the closure returns an error, WithNetNS attempts to restore the original namespace before returning.

func WithNetNSPath

func WithNetNSPath(nspath string, lockThread bool, f func(*os.File) error) error

WithNetNSPath executes the passed closure under the given network namespace, restoring the original namespace afterwards. Changing namespaces must be done on a goroutine that has been locked to an OS thread. If lockThread arg is true, this function locks the goroutine prior to change namespace and unlocks before returning

Source Files

ns.go

Version
v0.2.0-rc1
Published
Apr 22, 2016
Platform
js/wasm
Imports
4 packages
Last checked
3 days ago

Tools for package owners.