netutil

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func AcquireNextID

func AcquireNextID(l []*NetworkConfigList) (int, error)

AcquireNextID suggests the next ID.

func GenerateIPAM added in v0.16.0

func GenerateIPAM(driver string, subnetStr string) (map[string]interface{}, error)

func GetBridgeName added in v0.16.0

func GetBridgeName(id int) string

func NerdctlID

func NerdctlID(b []byte) *int

func NerdctlLabels added in v0.11.0

func NerdctlLabels(b []byte) *map[string]string

Types

type CNIEnv

type CNIEnv struct {
	Path        string
	NetconfPath string
}

type CNIPlugin added in v0.16.0

type CNIPlugin interface {
	GetPluginType() string
}

func GenerateCNIPlugins added in v0.16.0

func GenerateCNIPlugins(driver string, id int, ipam map[string]interface{}) ([]CNIPlugin, error)

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

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

type NetworkConfigList

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

func ConfigLists

func ConfigLists(e *CNIEnv) ([]*NetworkConfigList, error)

ConfigLists loads config from dir if dir exists. The result also contains DefaultConfigList

func DefaultConfigList

func DefaultConfigList(e *CNIEnv) (*NetworkConfigList, error)

func GenerateConfigList

func GenerateConfigList(e *CNIEnv, labels []string, id int, name string, plugins []CNIPlugin) (*NetworkConfigList, error)

GenerateConfigList creates NetworkConfigList. GenerateConfigList does not fill "File" field.

TODO: enable CNI isolation plugin

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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