netutil

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 28 Imported by: 1

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 added in v0.16.1

func ParseMTU(mtu string) (int, error)

ParseMTU parses the mtu option

func UsedNetworks added in v1.1.0

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

Types

type CNIEnv

type CNIEnv struct {
	Path        string
	NetconfPath string
}

func NewCNIEnv added in v0.18.0

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

func (*CNIEnv) CreateNetwork added in v0.22.1

func (e *CNIEnv) CreateNetwork(opts CreateOptions) (*NetworkConfig, error)

func (*CNIEnv) FilterNetworks added in v1.1.0

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

func (*CNIEnv) GetDefaultNetworkConfig added in v1.1.0

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 added in v1.1.0

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

func (*CNIEnv) NetworkMap added in v0.18.0

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

func (*CNIEnv) RemoveNetwork added in v0.22.1

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

type CNIEnvOpt added in v1.1.0

type CNIEnvOpt func(e *CNIEnv) error

func WithDefaultNetwork added in v1.1.0

func WithDefaultNetwork() CNIEnvOpt

type CNIPlugin added in v0.16.0

type CNIPlugin interface {
	GetPluginType() string
}

type CreateOptions added in v0.22.1

type CreateOptions struct {
	Name        string
	Driver      string
	Options     map[string]string
	IPAMDriver  string
	IPAMOptions map[string]string
	Subnet      string
	Gateway     string
	IPRange     string
	Labels      []string
}

type IPAMRange added in v0.16.1

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 added in v0.16.0

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

type NetworkConfig added in v1.1.0

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