network

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2018 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructEndpointID

func ConstructEndpointID(containerID string, netNsPath string, ifName string) (string, string)

ConstructEndpointID constructs endpoint name from netNsPath.

Types

type DNSInfo

type DNSInfo struct {
	Suffix  string
	Servers []string
}

DNSInfo contains DNS information for a container network or endpoint.

type EndpointInfo

type EndpointInfo struct {
	Id          string
	ContainerID string
	NetNsPath   string
	IfName      string
	IPAddresses []net.IPNet
	Routes      []RouteInfo
	DNS         DNSInfo
	Policies    []policy.Policy
	Data        map[string]interface{}
}

EndpointInfo contains read-only information about an endpoint.

type Namespace

type Namespace struct {
	// contains filtered or unexported fields
}

Namespace represents a network namespace.

func GetCurrentThreadNamespace added in v1.0.0

func GetCurrentThreadNamespace() (*Namespace, error)

GetCurrentThreadNamespace returns the caller thread's current namespace.

func OpenNamespace added in v1.0.0

func OpenNamespace(nsPath string) (*Namespace, error)

OpenNamespace creates a new namespace object for the given netns path.

func (*Namespace) Close

func (ns *Namespace) Close() error

Close releases the resources associated with the namespace object.

func (*Namespace) Enter

func (ns *Namespace) Enter() error

Enter puts the caller thread inside the namespace.

func (*Namespace) Exit

func (ns *Namespace) Exit() error

Exit puts the caller thread to its previous namespace.

func (*Namespace) GetFd

func (ns *Namespace) GetFd() uintptr

GetFd returns the file descriptor of the namespace.

type NetworkInfo

type NetworkInfo struct {
	Id         string
	Mode       string
	Subnets    []SubnetInfo
	DNS        DNSInfo
	Policies   []policy.Policy
	BridgeName string
	Options    map[string]interface{}
}

NetworkInfo contains read-only information about a container network.

type NetworkManager

type NetworkManager interface {
	Initialize(config *common.PluginConfig) error
	Uninitialize()

	AddExternalInterface(ifName string, subnet string) error

	CreateNetwork(nwInfo *NetworkInfo) error
	DeleteNetwork(networkId string) error
	GetNetworkInfo(networkId string) (*NetworkInfo, error)

	CreateEndpoint(networkId string, epInfo *EndpointInfo) error
	DeleteEndpoint(networkId string, endpointId string) error
	GetEndpointInfo(networkId string, endpointId string) (*EndpointInfo, error)
	AttachEndpoint(networkId string, endpointId string, sandboxKey string) (*endpoint, error)
	DetachEndpoint(networkId string, endpointId string) error
}

NetworkManager API.

func NewNetworkManager

func NewNetworkManager() (NetworkManager, error)

Creates a new network manager.

type RouteInfo

type RouteInfo struct {
	Dst net.IPNet
	Gw  net.IP
}

RouteInfo contains information about an IP route.

type SubnetInfo

type SubnetInfo struct {
	Family  platform.AddressFamily
	Prefix  net.IPNet
	Gateway net.IP
}

SubnetInfo contains subnet information for a container network.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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