package plugin

import "github.com/containernetworking/cni/pkg/plugin"

Index

Functions

func ConfigureIface

func ConfigureIface(ifName string, res *Result) error

ConfigureIface takes the result of IPAM plugin and applies to the ifName interface

func ExecDel

func ExecDel(plugin string, netconf []byte) error

ExecDel executes IPAM plugin, assuming CNI_COMMAND == DEL.

func Find

func Find(plugin string) string

Find returns the full path of the plugin by searching in CNI_PATH

Types

type Error

type Error struct {
	Code    uint   `json:"code"`
	Msg     string `json:"msg"`
	Details string `json:"details,omitempty"`
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Print

func (e *Error) Print() error

type IPConfig

type IPConfig struct {
	IP      net.IPNet
	Gateway net.IP
	Routes  []Route
}

IPConfig contains values necessary to configure an interface

func (*IPConfig) MarshalJSON

func (c *IPConfig) MarshalJSON() ([]byte, error)

func (*IPConfig) UnmarshalJSON

func (c *IPConfig) UnmarshalJSON(data []byte) error

type NetConf

type NetConf struct {
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
	IPAM struct {
		Type string `json:"type,omitempty"`
	} `json:"ipam,omitempty"`
}

NetConf describes a network.

type Result

type Result struct {
	IP4 *IPConfig `json:"ip4,omitempty"`
	IP6 *IPConfig `json:"ip6,omitempty"`
}

Result is what gets returned from the plugin (via stdout) to the caller

func ExecAdd

func ExecAdd(plugin string, netconf []byte) (*Result, error)

ExecAdd executes IPAM plugin, assuming CNI_COMMAND == ADD. Parses and returns resulting IPConfig

func (*Result) Print

func (r *Result) Print() error

type Route

type Route struct {
	Dst net.IPNet
	GW  net.IP
}

func (*Route) MarshalJSON

func (r *Route) MarshalJSON() ([]byte, error)

func (*Route) UnmarshalJSON

func (r *Route) UnmarshalJSON(data []byte) error

Source Files

ipam.go types.go

Version
v0.1.0
Published
Jul 22, 2015
Platform
js/wasm
Imports
10 packages
Last checked
2 days ago

Tools for package owners.