plugin

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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

func PrintError added in v0.5.6

func PrintError(err *Error) error

PrintError writes out prettified Error JSON to stdout

func PrintResult

func PrintResult(res *Result) error

PrintResult writes out prettified Result JSON to stdout

Types

type Error added in v0.5.6

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

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

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

Jump to

Keyboard shortcuts

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