plugin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 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

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

Jump to

Keyboard shortcuts

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