network

package
v0.7.4-0...-1151f9e Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2014 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotValidStrategyType = errors.New("not a valid network strategy type")
)

Functions

func ChangeInterfaceName

func ChangeInterfaceName(old, newName string) error

func CreateVethPair

func CreateVethPair(name1, name2 string) error

func InterfaceDown

func InterfaceDown(name string) error

func InterfaceUp

func InterfaceUp(name string) error

func SetDefaultGateway

func SetDefaultGateway(ip, ifaceName string) error

func SetInterfaceInNamespacePid

func SetInterfaceInNamespacePid(name string, nsPid int) error

func SetInterfaceIp

func SetInterfaceIp(name string, rawIp string) error

func SetInterfaceMaster

func SetInterfaceMaster(name, master string) error

func SetMtu

func SetMtu(name string, mtu int) error

Types

type Loopback

type Loopback struct {
}

Loopback is a network strategy that provides a basic loopback device

func (*Loopback) Create

func (l *Loopback) Create(n *libcontainer.Network, nspid int, context libcontainer.Context) error

func (*Loopback) Initialize

func (l *Loopback) Initialize(config *libcontainer.Network, context libcontainer.Context) error

type NetNS

type NetNS struct {
}

crosbymichael: could make a network strategy that instead of returning veth pair names it returns a pid to an existing network namespace

func (*NetNS) Create

func (v *NetNS) Create(n *libcontainer.Network, nspid int, context libcontainer.Context) error

func (*NetNS) Initialize

func (v *NetNS) Initialize(config *libcontainer.Network, context libcontainer.Context) error

type NetworkStrategy

type NetworkStrategy interface {
	Create(*libcontainer.Network, int, libcontainer.Context) error
	Initialize(*libcontainer.Network, libcontainer.Context) error
}

NetworkStrategy represents a specific network configuration for a container's networking stack

func GetStrategy

func GetStrategy(tpe string) (NetworkStrategy, error)

GetStrategy returns the specific network strategy for the provided type. If no strategy is registered for the type an ErrNotValidStrategyType is returned.

type Veth

type Veth struct {
}

Veth is a network strategy that uses a bridge and creates a veth pair, one that stays outside on the host and the other is placed inside the container's namespace

func (*Veth) Create

func (v *Veth) Create(n *libcontainer.Network, nspid int, context libcontainer.Context) error

func (*Veth) Initialize

func (v *Veth) Initialize(config *libcontainer.Network, context libcontainer.Context) error

Jump to

Keyboard shortcuts

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