netns

package
v0.0.0-...-d002785 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package netns provides a utility function that allows a user to perform actions in a different network namespace

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(nsName string, cb Callback) error

Do takes a function which it will call in the network namespace specified by nsName. The goroutine that calls this will lock itself to its current OS thread, hop namespaces, call the given function, hop back to its original namespace, and then unlock itself from its current OS thread. Do returns an error if an error occurs at any point besides in the invocation of the given function. The caller should check both the error of Do and any errors from the given function call.

func ParseAddress

func ParseAddress(address string) (nsName string, addr string, err error)

ParseAddress takes in an address string, parsing out the address and an optional VRF name. It returns the namespace corresponding to the VRF. The expected form is [<vrf-name>/]address:port. However, ParseAddress will not actually check to see if the VRF name or address are valid. Presumably, when those values are used later, they will fail if they are malformed

func VRFToNetNS

func VRFToNetNS(vrf string) string

VRFToNetNS converts a VRF name to network namespace's name corresponding to that VRF.

Types

type Callback

type Callback func()

Callback is a function that gets called in a given network namespace. The user needs to check any errors from any calls inside this function.

Jump to

Keyboard shortcuts

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