network

package
v3.1.0-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: BSD-3-Clause Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// ErrNoCNIConfig corresponds to a missing CNI configuration path
	ErrNoCNIConfig = netError("no CNI configuration path provided")
	// ErrNoCNIPlugin corresponds to a missing CNI plugin path
	ErrNoCNIPlugin = netError("no CNI plugin path provided")
)

Variables

This section is empty.

Functions

func GetAllNetworkConfigList

func GetAllNetworkConfigList(cniPath *CNIPath) ([]*libcni.NetworkConfigList, error)

GetAllNetworkConfigList lists configured networks in configuration path directory provided by cniPath

Types

type CNIPath

type CNIPath struct {
	Conf   string
	Plugin string
}

CNIPath contains path to CNI configuration directory and path to executable CNI plugins directory

type PortMapEntry

type PortMapEntry struct {
	HostPort      int    `json:"hostPort"`
	ContainerPort int    `json:"containerPort"`
	Protocol      string `json:"protocol"`
	HostIP        string `json:"hostIP,omitempty"`
}

PortMapEntry describes a port mapping between host and container

type Setup

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

Setup contains network installation setup

func NewSetup

func NewSetup(networks []string, containerID string, netNS string, cniPath *CNIPath) (*Setup, error)

NewSetup creates and returns a network setup to configure, add and remove network interfaces in container

func NewSetupFromConfig

func NewSetupFromConfig(networkConfList []*libcni.NetworkConfigList, containerID string, netNS string, cniPath *CNIPath) (*Setup, error)

NewSetupFromConfig creates and returns network setup to configure from a network configuration list

func (*Setup) AddNetworks

func (m *Setup) AddNetworks() error

AddNetworks brings up networks interface in container

func (*Setup) DelNetworks

func (m *Setup) DelNetworks() error

DelNetworks tears down networks interface in container

func (*Setup) GetNetworkIP

func (m *Setup) GetNetworkIP(network string, version string) (net.IP, error)

GetNetworkIP returns IP associated with a configured network, if network is empty, the function returns IP for the first configured network

func (*Setup) GetNetworkInterface

func (m *Setup) GetNetworkInterface(network string) (string, error)

GetNetworkInterface returns container network interface associated with a network, if network is empty, the function returns interface for the first configured network

func (*Setup) SetArgs

func (m *Setup) SetArgs(args []string) error

SetArgs affects arguments to corresponding network plugins

func (*Setup) SetCapability

func (m *Setup) SetCapability(network string, capName string, args interface{}) error

SetCapability sets capability arguments for the corresponding network plugin uses by a configured network

func (*Setup) SetEnvPath

func (m *Setup) SetEnvPath(envPath string)

SetEnvPath allows to define custom paths for PATH environment variables used during CNI plugin execution

Jump to

Keyboard shortcuts

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