types

package
v0.6.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUnknown                uint = iota // 0
	ErrIncompatibleCNIVersion             // 1
	ErrUnsupportedField                   // 2
)

Well known error codes see https://github.com/containernetworking/cni/blob/master/SPEC.md#well-known-error-codes

Variables

View Source
var NotImplementedError = errors.New("Not Implemented")

NotImplementedError is used to indicate that a method is not implemented for the given platform

Functions

func GetKeyField

func GetKeyField(keyString string, v reflect.Value) reflect.Value

GetKeyField is a helper function to receive Values Values that represent a pointer to a struct

func LoadArgs

func LoadArgs(args string, container interface{}) error

LoadArgs parses args from a string in the form "K=V;K2=V2;..."

func ParseCIDR

func ParseCIDR(s string) (*net.IPNet, error)

ParseCIDR takes a string like "10.2.3.1/24" and return IPNet with "10.2.3.1" and /24 mask

func PrintResult added in v0.5.0

func PrintResult(result Result, version string) error

Types

type CommonArgs

type CommonArgs struct {
	IgnoreUnknown UnmarshallableBool `json:"ignoreunknown,omitempty"`
}

CommonArgs contains the IgnoreUnknown argument and must be embedded by all Arg structs

type DNS

type DNS struct {
	Nameservers []string `json:"nameservers,omitempty"`
	Domain      string   `json:"domain,omitempty"`
	Search      []string `json:"search,omitempty"`
	Options     []string `json:"options,omitempty"`
}

DNS contains values interesting for DNS resolvers

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 IPNet

type IPNet net.IPNet

like net.IPNet but adds JSON marshalling and unmarshalling

func (IPNet) MarshalJSON

func (n IPNet) MarshalJSON() ([]byte, error)

func (*IPNet) UnmarshalJSON

func (n *IPNet) UnmarshalJSON(data []byte) error

type NetConf

type NetConf struct {
	CNIVersion string `json:"cniVersion,omitempty"`

	Name         string          `json:"name,omitempty"`
	Type         string          `json:"type,omitempty"`
	Capabilities map[string]bool `json:"capabilities,omitempty"`
	IPAM         struct {
		Type string `json:"type,omitempty"`
	} `json:"ipam,omitempty"`
	DNS DNS `json:"dns"`
}

NetConf describes a network.

type NetConfList added in v0.5.0

type NetConfList struct {
	CNIVersion string `json:"cniVersion,omitempty"`

	Name    string     `json:"name,omitempty"`
	Plugins []*NetConf `json:"plugins,omitempty"`
}

NetConfList describes an ordered list of networks.

type Result

type Result interface {
	// The highest CNI specification result verison the result supports
	// without having to convert
	Version() string

	// Returns the result converted into the requested CNI specification
	// result version, or an error if conversion failed
	GetAsVersion(version string) (Result, error)

	// Prints the result in JSON format to stdout
	Print() error

	// Returns a JSON string representation of the result
	String() string
}

Result is an interface that provides the result of plugin execution

type ResultFactoryFunc added in v0.5.0

type ResultFactoryFunc func([]byte) (Result, error)

type Route

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

func (*Route) MarshalJSON

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

func (*Route) String added in v0.5.0

func (r *Route) String() string

func (*Route) UnmarshalJSON

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

type UnmarshalableArgsError added in v0.6.0

type UnmarshalableArgsError struct {
	// contains filtered or unexported fields
}

UnmarshalableArgsError is used to indicate error unmarshalling args from the args-string in the form "K=V;K2=V2;..."

type UnmarshallableBool

type UnmarshallableBool bool

UnmarshallableBool typedef for builtin bool because builtin type's methods can't be declared

func (*UnmarshallableBool) UnmarshalText

func (b *UnmarshallableBool) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface. Returns boolean true if the string is "1" or "[Tt]rue" Returns boolean false if the string is "0" or "[Ff]alse"

type UnmarshallableString added in v0.4.0

type UnmarshallableString string

UnmarshallableString typedef for builtin string

func (*UnmarshallableString) UnmarshalText added in v0.4.0

func (s *UnmarshallableString) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface. Returns the string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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