network

package
v0.0.0-...-d691e2b Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBridge

func CreateBridge(opt *NetworkOption) (*net.Interface, error)

func SetupNATOut

func SetupNATOut(cidr string, action iptables.Action) error

SetupNATOut adds NAT rules for outbound traffic with iptables.

Types

type ContainerNetwork

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

func (*ContainerNetwork) InitNetwork

func (c *ContainerNetwork) InitNetwork(opt *NetworkOption) error

func (*ContainerNetwork) SetContainerNet

func (c *ContainerNetwork) SetContainerNet(containerPid int) error

func (*ContainerNetwork) UnsetContainerNet

func (c *ContainerNetwork) UnsetContainerNet(containerPid int) error

type NetworkManagerInterface

type NetworkManagerInterface interface {
	InitNetwork(opt *NetworkOption) error
	SetContainerNet(containerPid int) error
	UnsetContainerNet(containerPid int) error
}

func NewNetworkManager

func NewNetworkManager() NetworkManagerInterface

type NetworkOption

type NetworkOption struct {
	BridgeName string
	BridgeIP   string
	MTU        int

	EnableIcc bool
}

func NewNetworkOption

func NewNetworkOption() *NetworkOption

func (*NetworkOption) AddFlags

func (s *NetworkOption) AddFlags(fs *pflag.FlagSet)

type Veth

type Veth struct {
	ContainerPID int
	IP           net.IP
	// contains filtered or unexported fields
}

func (*Veth) BindContainer

func (v *Veth) BindContainer(gatewayIP string, addr *net.IPNet) error

func (*Veth) Init

func (v *Veth) Init(pid int, bridgeName string) error

Jump to

Keyboard shortcuts

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