netutil

package
v0.18.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func GenerateIPAM added in v0.16.0

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

func GetBridgeName added in v0.16.0

func GetBridgeName(id int) string

func ParseMTU added in v0.16.1

func ParseMTU(mtu string) (int, error)

ParseMTU parses the mtu option

Types

type CNIEnv

type CNIEnv struct {
	Path        string
	NetconfPath string
	Networks    []*networkConfig
}

func NewCNIEnv added in v0.18.0

func NewCNIEnv(cniPath, cniConfPath string) (*CNIEnv, error)

func (*CNIEnv) AcquireNextID added in v0.18.0

func (e *CNIEnv) AcquireNextID() (int, error)

AcquireNextID suggests the next ID.

func (*CNIEnv) DefaultNetworkConfig added in v0.18.0

func (e *CNIEnv) DefaultNetworkConfig() (*networkConfig, error)

func (*CNIEnv) GenerateCNIPlugins added in v0.18.0

func (e *CNIEnv) GenerateCNIPlugins(driver string, id int, name string, ipam map[string]interface{}, opts map[string]string) ([]CNIPlugin, error)

func (*CNIEnv) GenerateNetworkConfig added in v0.18.0

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

GenerateNetworkConfig creates networkConfig. GenerateNetworkConfig does not fill "File" field.

func (*CNIEnv) NetworkMap added in v0.18.0

func (e *CNIEnv) NetworkMap() map[string]*networkConfig

func (*CNIEnv) WriteNetworkConfig added in v0.18.0

func (e *CNIEnv) WriteNetworkConfig(net *networkConfig) error

WriteNetworkConfig writes networkConfig file to cni config path.

type CNIPlugin added in v0.16.0

type CNIPlugin interface {
	GetPluginType() 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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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