netutil

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultNetworkName = "bridge"
	DefaultID          = 0
	DefaultCIDR        = "10.4.0.0/24"
)
View Source
const ConfigListTemplate = `` /* 687-byte string literal not displayed */

ConfigListTemplate was copied from https://github.com/containers/podman/blob/v2.2.0/cni/87-podman-bridge.conflist

Variables

This section is empty.

Functions

func AcquireNextID

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

AcquireNextID suggests the next ID.

func NerdctlID

func NerdctlID(b []byte) *int

Types

type CNIEnv

type CNIEnv struct {
	Path        string
	NetconfPath string
}

type ConfigListTemplateOpts

type ConfigListTemplateOpts struct {
	ID           int
	Name         string // e.g. "nerdctl"
	Subnet       string // e.g. "10.4.0.0/16"
	Gateway      string // e.g. "10.4.0.1"
	ExtraPlugins string // e.g. `,{"type":"isolation"}`
}

type NetworkConfigList

type NetworkConfigList struct {
	*libcni.NetworkConfigList
	NerdctlID *int
	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, id int, name, cidr string) (*NetworkConfigList, error)

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

TODO: enable CNI isolation plugin

Jump to

Keyboard shortcuts

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