network

package
Version: v0.0.0-...-199bfc6 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeBuilder

type BridgeBuilder struct{}

BridgeBuilder implements NetworkBuilder interface by bridging containers to an ENI on Linux.

func (*BridgeBuilder) DeleteEndpoint

func (nb *BridgeBuilder) DeleteEndpoint(nw *Network, ep *Endpoint) error

DeleteEndpoint deletes an endpoint from a container network. Deletion is best-effort; tries to clean up endpoint artifacts as much as possible.

func (*BridgeBuilder) DeleteNetwork

func (nb *BridgeBuilder) DeleteNetwork(nw *Network) error

DeleteNetwork deletes a container network.

func (*BridgeBuilder) FindOrCreateEndpoint

func (nb *BridgeBuilder) FindOrCreateEndpoint(nw *Network, ep *Endpoint) error

FindOrCreateEndpoint connects the ENI to target network namespace using veth pairs.

func (*BridgeBuilder) FindOrCreateNetwork

func (nb *BridgeBuilder) FindOrCreateNetwork(nw *Network) error

FindOrCreateNetwork creates a new container network.

type Builder

type Builder interface {
	FindOrCreateNetwork(nw *Network) error
	DeleteNetwork(nw *Network) error
	FindOrCreateEndpoint(nw *Network, ep *Endpoint) error
	DeleteEndpoint(nw *Network, ep *Endpoint) error
}

Builder knows how to build container networks and connect container network interfaces.

type Endpoint

type Endpoint struct {
	ContainerID string
	NetNSName   string
	IfName      string
	IfType      string
	TapUserID   int
	MACAddress  net.HardwareAddr
	IPAddress   *net.IPNet
}

Endpoint represents a container network interface.

type Network

type Network struct {
	Name                string
	BridgeType          string
	BridgeNetNSPath     string
	BridgeIndex         int
	SharedENI           *eni.ENI
	ENIIPAddress        *net.IPNet
	GatewayIPAddress    net.IP
	VPCCIDRs            []net.IPNet
	DNSServers          []string
	DNSSuffixSearchList []string
	ServiceCIDR         string
}

Network represents a container network.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL