netutil

package
v2.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 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 FirewallPluginGEQVersion added in v2.1.4

func FirewallPluginGEQVersion(firewallPath string, versionStr string) (bool, error)

FirewallPluginGEQVersion checks if the firewall plugin is greater than or equal to the specified version

func UsedNetworks

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

Types

type CNIEnv

type CNIEnv struct {
	Path        string
	NetconfPath string
	Namespace   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) 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) ListNetworksMatch

func (e *CNIEnv) ListNetworksMatch(reqs []string, allowPseudoNetwork bool) (list map[string][]*NetworkConfig, errs []error)

func (*CNIEnv) NetworkByNameOrID

func (e *CNIEnv) NetworkByNameOrID(key string) (*NetworkConfig, error)

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(bridgeIP string) CNIEnvOpt

func WithNamespace

func WithNamespace(namespace string) 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