netutil

package
v2.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 30 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultNetworkName = "bridge"
	DefaultCIDR        = "10.4.0.0/24"
	DefaultIPAMDriver  = "host-local"

	// When creating non-default network without passing in `--subnet` option,
	// nerdctl assigns subnet address for the creation starting from `StartingCIDR`
	// This prevents subnet address overlapping with `DefaultCIDR` used by the default network
	StartingCIDR = "10.4.1.0/24"
)

Variables

This section is empty.

Functions

func ParseMTU

func ParseMTU(mtu string) (int, error)

ParseMTU parses the mtu option

func UsedNetworks

func UsedNetworks(ctx context.Context, client *containerd.Client) (map[string][]string, error)

Types

type CNIEnv

type CNIEnv struct {
	Path        string
	NetconfPath string
}

func NewCNIEnv

func NewCNIEnv(cniPath, cniConfPath string, opts ...CNIEnvOpt) (*CNIEnv, error)

func (*CNIEnv) CreateNetwork

func (e *CNIEnv) CreateNetwork(opts types.NetworkCreateOptions) (*NetworkConfig, error)

func (*CNIEnv) FilterNetworks

func (e *CNIEnv) FilterNetworks(filterf func(*NetworkConfig) bool) ([]*NetworkConfig, error)

func (*CNIEnv) GetDefaultNetworkConfig

func (e *CNIEnv) GetDefaultNetworkConfig() (*NetworkConfig, error)

GetDefaultNetworkConfig checks whether the default network exists by first searching for if any network bears the `labels.NerdctlDefaultNetwork` label, or falls back to checking whether any network bears the `DefaultNetworkName` name.

func (*CNIEnv) NetworkList

func (e *CNIEnv) NetworkList() ([]*NetworkConfig, error)

func (*CNIEnv) NetworkMap

func (e *CNIEnv) NetworkMap() (map[string]*NetworkConfig, error)

func (*CNIEnv) RemoveNetwork

func (e *CNIEnv) RemoveNetwork(net *NetworkConfig) error

type CNIEnvOpt

type CNIEnvOpt func(e *CNIEnv) error

func WithDefaultNetwork

func WithDefaultNetwork() CNIEnvOpt

type CNIPlugin

type CNIPlugin interface {
	GetPluginType() string
}

type IPAMRange

type IPAMRange struct {
	Subnet     string `json:"subnet"`
	RangeStart string `json:"rangeStart,omitempty"`
	RangeEnd   string `json:"rangeEnd,omitempty"`
	Gateway    string `json:"gateway,omitempty"`
	IPRange    string `json:"ipRange,omitempty"`
}

type IPAMRoute

type IPAMRoute struct {
	Dst     string `json:"dst,omitempty"`
	GW      string `json:"gw,omitempty"`
	Gateway string `json:"gateway,omitempty"`
}

type NetworkConfig

type NetworkConfig struct {
	*libcni.NetworkConfigList
	NerdctlID     *string
	NerdctlLabels *map[string]string
	File          string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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