sandbox

package
v0.0.0-...-7c707bc Latest Latest
Warning

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

Go to latest
Published: May 21, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(containerID string) string

GenerateKey generates a sandbox key based on the passed container id.

Types

type Info

type Info struct {
	Interfaces []*Interface

	// IPv4 gateway for the sandbox.
	Gateway net.IP

	// IPv6 gateway for the sandbox.
	GatewayIPv6 net.IP
}

Info represents all possible information that the driver wants to place in the sandbox which includes interfaces, routes and gateway

func (*Info) Equal

func (s *Info) Equal(o *Info) bool

Equal checks if this instance of SandboxInfo is equal to the passed one

func (*Info) GetCopy

func (s *Info) GetCopy() *Info

GetCopy returns a copy of this SandboxInfo structure

type Interface

type Interface struct {
	// The name of the interface in the origin network namespace.
	SrcName string

	// The name that will be assigned to the interface once moves inside a
	// network namespace.
	DstName string

	// IPv4 address for the interface.
	Address *net.IPNet

	// IPv6 address for the interface.
	AddressIPv6 *net.IPNet
}

Interface represents the settings and identity of a network device. It is used as a return type for Network.Link, and it is common practice for the caller to use this information when moving interface SrcName from host namespace to DstName in a different net namespace with the appropriate network settings.

func (*Interface) Equal

func (i *Interface) Equal(o *Interface) bool

Equal checks if this instance of Interface is equal to the passed one

func (*Interface) GetCopy

func (i *Interface) GetCopy() *Interface

GetCopy returns a copy of this Interface structure

type Sandbox

type Sandbox interface {
	// The path where the network namespace is mounted.
	Key() string

	// The collection of Interface previously added with the AddInterface
	// method. Note that this doesn't incude network interfaces added in any
	// other way (such as the default loopback interface which are automatically
	// created on creation of a sandbox).
	Interfaces() []*Interface

	// Add an existing Interface to this sandbox. The operation will rename
	// from the Interface SrcName to DstName as it moves, and reconfigure the
	// interface according to the specified settings.
	AddInterface(*Interface) error

	// Remove an interface from the sandbox by renamin to original name
	// and moving it out of the sandbox.
	RemoveInterface(*Interface) error

	// Set default IPv4 gateway for the sandbox
	SetGateway(gw net.IP) error

	// Set default IPv6 gateway for the sandbox
	SetGatewayIPv6(gw net.IP) error

	// Destroy the sandbox
	Destroy() error
}

Sandbox represents a network sandbox, identified by a specific key. It holds a list of Interfaces, routes etc, and more can be added dynamically.

func NewSandbox

func NewSandbox(key string, osCreate bool) (Sandbox, error)

NewSandbox provides a new sandbox instance created in an os specific way provided a key which uniquely identifies the sandbox

Jump to

Keyboard shortcuts

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