network

package
v0.333.2-candidate Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2016 License: Apache-2.0 Imports: 9 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddToBridgeError

type AddToBridgeError struct {
	Cause         error
	Bridge, Slave *net.Interface
}

AddToBridgeError is returned if an error occurs while adding an interface to a bridge

func (AddToBridgeError) Error

func (err AddToBridgeError) Error() string

type BridgeDetectionError

type BridgeDetectionError struct {
	Cause  error
	Name   string
	IP     net.IP
	Subnet *net.IPNet
}

BridgeDetectionError is returned if an error occurs while creating a bridge

func (BridgeDetectionError) Error

func (err BridgeDetectionError) Error() string

type ConfigureDefaultGWError

type ConfigureDefaultGWError struct {
	Cause     error
	Interface *net.Interface
	IP        net.IP
}

ConfigureDefaultGWError is returned if the default gateway cannot be updated

func (ConfigureDefaultGWError) Error

func (err ConfigureDefaultGWError) Error() string

type ConfigureLinkError

type ConfigureLinkError struct {
	Cause          error
	Role           string
	Interface      *net.Interface
	IntendedIP     net.IP
	IntendedSubnet *net.IPNet
}

ConfigureLinkError is returned if configuring a link fails

func (ConfigureLinkError) Error

func (err ConfigureLinkError) Error() string

type Configurer

type Configurer interface {
	ConfigureContainer(*ContainerConfig) error
	ConfigureHost(*HostConfig) error
}

func NewConfigurer

func NewConfigurer(log lager.Logger) Configurer

type ContainerConfig

type ContainerConfig struct {
	Hostname      string
	ContainerIntf string
	ContainerIP   net.IP
	GatewayIP     net.IP
	Subnet        *net.IPNet
	Mtu           int
}

type DeleteLinkError

type DeleteLinkError struct {
	Cause error
	Role  string
	Name  string
}

DeleteLinkError is returned if an interface cannot be succesfully destroyed

func (DeleteLinkError) Error

func (err DeleteLinkError) Error() string

type Filter

type Filter interface {
	Setup(logPrefix string) error
	TearDown()
	NetOut(garden.NetOutRule) error
}

func NewFilter

func NewFilter(instanceChain iptables.Chain) Filter

type FindLinkError

type FindLinkError struct {
	Cause error // may be nil if no error occurred other than the link not existing
	Role  string
	Name  string
}

FindLinkError is returned if an expected interface cannot be found inside the container

func (FindLinkError) Error

func (err FindLinkError) Error() string

type HostConfig

type HostConfig struct {
	HostIntf      string
	BridgeName    string
	BridgeIP      net.IP
	ContainerIntf string
	ContainerPid  int
	Subnet        *net.IPNet
	Mtu           int
}

type Hostname

type Hostname interface {
	SetHostname(hostName string) error
}

type LinkUpError

type LinkUpError struct {
	Cause error
	Link  *net.Interface
	Role  string
}

LinkUpError is returned if brinding an interface up fails

func (LinkUpError) Error

func (err LinkUpError) Error() string

type MTUError

type MTUError struct {
	Cause error
	Intf  *net.Interface
	MTU   int
}

MTUError is returned if setting the Mtu on an interface fails

func (MTUError) Error

func (err MTUError) Error() string

type Network

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

func New

func New(ipNet *net.IPNet) *Network

func (*Network) CIDRSuffix

func (n *Network) CIDRSuffix() int

func (Network) ContainerIP

func (n Network) ContainerIP() net.IP

func (Network) HostIP

func (n Network) HostIP() net.IP

func (Network) IP

func (n Network) IP() net.IP

func (Network) IPNet

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

func (Network) MarshalJSON

func (n Network) MarshalJSON() ([]byte, error)

func (Network) String

func (n Network) String() string

func (*Network) UnmarshalJSON

func (n *Network) UnmarshalJSON(data []byte) error

type NetworkConfigurer

type NetworkConfigurer struct {
	Hostname Hostname

	Veth interface {
		Create(hostIfcName, containerIfcName string) (*net.Interface, *net.Interface, error)
	}

	Link interface {
		AddIP(intf *net.Interface, ip net.IP, subnet *net.IPNet) error
		AddDefaultGW(intf *net.Interface, ip net.IP) error
		SetUp(intf *net.Interface) error
		SetMTU(intf *net.Interface, mtu int) error
		SetNs(intf *net.Interface, pid int) error
		InterfaceByName(name string) (*net.Interface, bool, error)
	}

	Bridge interface {
		Create(bridgeName string, ip net.IP, subnet *net.IPNet) (*net.Interface, error)
		Add(bridge, slave *net.Interface) error
	}

	Logger lager.Logger
}

func (*NetworkConfigurer) ConfigureContainer

func (c *NetworkConfigurer) ConfigureContainer(config *ContainerConfig) error

func (*NetworkConfigurer) ConfigureHost

func (c *NetworkConfigurer) ConfigureHost(config *HostConfig) error

type SetNsFailedError

type SetNsFailedError struct {
	Cause error
	Intf  *net.Interface
	Pid   int
}

func (SetNsFailedError) Error

func (err SetNsFailedError) Error() string

type VethPairCreationError

type VethPairCreationError struct {
	Cause                         error
	HostIfcName, ContainerIfcName string
}

VethPairCreationError is returned if creating a virtual ethernet pair fails

func (VethPairCreationError) Error

func (err VethPairCreationError) Error() string

Directories

Path Synopsis
fake_bridge_manager
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
The subnets package provides a subnet pool from which networks may be dynamically acquired or statically reserved.
The subnets package provides a subnet pool from which networks may be dynamically acquired or statically reserved.
fakes
This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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