lib

package
v0.0.0-...-dd9aec0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_ATTEMPTS = 10

Variables

This section is empty.

Functions

func NetNsDoStub

func NetNsDoStub(f func(h ns.NetNS) error) error

Types

type Common

type Common struct {
	NetlinkAdapter netlinkAdapter
	LinkOperations linkOperations
	Logger         lager.Logger
}

Common bevavior used by both the host-side and container-side Setup functions

func (*Common) BasicSetup

func (s *Common) BasicSetup(deviceName string, local, peer config.DualAddress) error

BasicSetup configures a veth device for point-to-point communication with its peer. It is meant to be called by either Host.Setup or Container.Setup

type Container

type Container struct {
	Common         common
	LinkOperations linkOperations
	Logger         lager.Logger
}

func (*Container) Setup

func (c *Container) Setup(cfg *config.Config) error

Setup will configure the network stack within the container A veth pair must already have been created, with one end given the TemporaryDeviceName and moved into the container. See VethPairCreator.

func (*Container) Teardown

func (c *Container) Teardown(containerNS ns.NetNS, deviceName string) error

Teardown deletes the named device from the container. The kernel should automatically cleanup the other end of the veth pair and any associated addresses, neighbor rules, etc

type Host

type Host struct {
	Common         common
	LinkOperations linkOperations
	Logger         lager.Logger
}

func (*Host) Setup

func (h *Host) Setup(cfg *config.Config) error

Setup will configure the network stack on the host A veth pair must already have been created. See VethPairCreator.

type LinkOperations

type LinkOperations struct {
	SysctlAdapter  sysctlAdapter
	NetlinkAdapter netlinkAdapter
	Logger         lager.Logger
}

LinkOperations exposes mid-level link setup operations. They encapsulate low-level netlink and sysctl commands.

func (*LinkOperations) DeleteLinkByName

func (s *LinkOperations) DeleteLinkByName(deviceName string) error

func (*LinkOperations) DisableIPv6

func (s *LinkOperations) DisableIPv6(deviceName string) error

func (*LinkOperations) EnableIPv4Forwarding

func (s *LinkOperations) EnableIPv4Forwarding() error

func (*LinkOperations) EnableReversePathFiltering

func (s *LinkOperations) EnableReversePathFiltering(deviceName string) error
func (s *LinkOperations) RenameLink(oldName, newName string) error

func (*LinkOperations) RouteAddAll

func (s *LinkOperations) RouteAddAll(routes []*types.Route, sourceIP net.IP) error

func (*LinkOperations) SetPointToPointAddress

func (s *LinkOperations) SetPointToPointAddress(link netlink.Link, localIPAddr, peerIPAddr net.IP) error

func (*LinkOperations) StaticNeighborNoARP

func (s *LinkOperations) StaticNeighborNoARP(link netlink.Link, destIP net.IP, hwAddr net.HardwareAddr) error

StaticNeighborNoARP disables ARP on the link and installs a single permanent neighbor rule that resolves the given destIP to the given hardware address

type VethPairCreator

type VethPairCreator struct {
	NetlinkAdapter netlinkAdapter
	Logger         lager.Logger
}

func (*VethPairCreator) Create

func (c *VethPairCreator) Create(cfg *config.Config) error

Create will create a pair of virtual ethernet devices and move one end into the container The container-side will have a temporary name.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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