current

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ImplementedSpecVersion string = "0.4.0"

Variables

View Source
var SupportedVersions = []string{"0.3.0", "0.3.1", ImplementedSpecVersion}

Functions

func Int added in v0.6.0

func Int(v int) *int

Int returns a pointer to the int value passed in. Used to set the IPConfig.Interface field.

func NewResult

func NewResult(data []byte) (types.Result, error)

Types

type IPConfig

type IPConfig struct {
	// IP version, either "4" or "6"
	Version string
	// Index into Result structs Interfaces list
	Interface *int
	Address   net.IPNet
	Gateway   net.IP
}

IPConfig contains values necessary to configure an IP address on an interface

func (*IPConfig) MarshalJSON

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

func (*IPConfig) String

func (i *IPConfig) String() string

func (*IPConfig) UnmarshalJSON

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

type Interface

type Interface struct {
	Name    string `json:"name"`
	Mac     string `json:"mac,omitempty"`
	Sandbox string `json:"sandbox,omitempty"`
}

Interface contains values about the created interfaces

func (*Interface) String

func (i *Interface) String() string

type Result

type Result struct {
	CNIVersion string         `json:"cniVersion,omitempty"`
	Interfaces []*Interface   `json:"interfaces,omitempty"`
	IPs        []*IPConfig    `json:"ips,omitempty"`
	Routes     []*types.Route `json:"routes,omitempty"`
	DNS        types.DNS      `json:"dns,omitempty"`
}

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

func GetResult

func GetResult(r types.Result) (*Result, error)

func NewResultFromResult

func NewResultFromResult(result types.Result) (*Result, error)

func (*Result) Convert

func (r *Result) Convert() (*Result, error)

Convert this old version result to the current CNI version result

func (*Result) GetAsVersion

func (r *Result) GetAsVersion(version string) (types.Result, error)

func (*Result) Print

func (r *Result) Print() error

func (*Result) PrintTo added in v0.7.0

func (r *Result) PrintTo(writer io.Writer) error

func (*Result) String

func (r *Result) String() string

String returns a formatted string in the form of "[Interfaces: $1,][ IP: $2,] DNS: $3" where $1 represents the receiver's Interfaces, $2 represents the receiver's IP addresses and $3 the receiver's DNS. If $1 or $2 are nil, they won't be present in the returned string.

func (*Result) Version

func (r *Result) Version() string

Jump to

Keyboard shortcuts

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