util

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultRoute

func AddDefaultRoute(gw net.IP, dev netlink.Link) error

AddDefaultRoute sets the default route on the given gateway.

func AddHostRoute

func AddHostRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error

AddHostRoute adds a host-scoped route to a device.

func AddRoute

func AddRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error

AddRoute adds a universally-scoped route to a device.

func DelLinkByName

func DelLinkByName(ifName string) error

DelLinkByName removes an interface link.

func DelLinkByNameAddr added in v0.3.2

func DelLinkByNameAddr(ifName string, family int) (*net.IPNet, error)

DelLinkByNameAddr remove an interface returns its IP address of the specified family

func Network added in v0.4.0

func Network(ipn *net.IPNet) *net.IPNet

func NextIP added in v0.3.0

func NextIP(ip net.IP) net.IP

func ParseCIDR

func ParseCIDR(s string) (*net.IPNet, error)

ParseCIDR invokes net.ParseCIDR.

func PluginMain added in v0.4.0

func PluginMain(cmdAdd, cmdDel func(_ *CmdArgs) error)

func PrevIP added in v0.3.0

func PrevIP(ip net.IP) net.IP

func SetNS

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

SetNS sets the network namespace on a target file.

func SetupIPMasq added in v0.3.2

func SetupIPMasq(ipn *net.IPNet, chain string) error

Installs iptables rules to masquerade traffic coming from ipn and going outside of it

func SetupVeth

func SetupVeth(entropy, contVethName string, mtu int, hostNS *os.File) (hostVeth, contVeth netlink.Link, err error)

SetupVeth sets up a virtual ethernet link. Should be in container netns. TODO(eyakubovich): get rid of entropy and ask kernel to pick name via pattern

func TeardownIPMasq added in v0.3.2

func TeardownIPMasq(ipn *net.IPNet, chain string) error

Undoes the effects of SetupIPMasq

func WithNetNS added in v0.4.0

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

WithNetNS executes the passed closure under the given network namespace, restoring the original namespace afterwards.

func WithNetNSPath

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

WithNetNSPath executes the passed closure under the given network namespace, restoring the original namespace afterwards.

Types

type CmdArgs added in v0.4.0

type CmdArgs struct {
	ContID   types.UUID
	Netns    string
	IfName   string
	NetConf  string
	NetName  string
	IPAMPath string
}

Jump to

Keyboard shortcuts

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