utils

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeTOMLFromPath

func DecodeTOMLFromPath(path string, v interface{}) error

DecodeTOMLFromPath decodes the toml file loaded from path Then unmarshal it into the given interface

func EnsureNetNS

func EnsureNetNS(name string) (netns.NsHandle, error)

EnsureNetNS creates the specified netns if it does not exist

func GetNetNS

func GetNetNS(name string) (netns.NsHandle, error)

GetNetNS returns the handle to the specified netns if it exists

func LinkLocalAddr

func LinkLocalAddr() *netlink.Addr

LinkLocalAddr generates a RFC 4862 compliant linklocal address, with a random mac address

func ReadCloserFromPath

func ReadCloserFromPath(path string) (io.ReadCloser, error)

ReadCloserFromPath returns a ReadCloser from the given path Path can be a file system path, a http url, or "-" for stdin

func WithNetNS

func WithNetNS(name string, fn func(handle *netlink.Handle) error) error

WithNetNS executes the given closure in specified netns

func WriteCloserFromPath

func WriteCloserFromPath(path string) (io.WriteCloser, error)

WriteCloserFromPath returns a WriteCloser from the given path Path can be a file system path, or "-" for stdout

Types

This section is empty.

Jump to

Keyboard shortcuts

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