package types020

import "github.com/containernetworking/cni/pkg/types/020"

Index

Constants

const ImplementedSpecVersion string = "0.2.0"

Functions

func NewResult

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

NewResult creates a new Result object from JSON data. The JSON data must be compatible with the CNI versions implemented by this type.

Types

type IPConfig

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

IPConfig contains values necessary to configure an interface

func (*IPConfig) Copy

func (i *IPConfig) Copy() *IPConfig

func (*IPConfig) MarshalJSON

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

func (*IPConfig) UnmarshalJSON

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

type Result

type Result struct {
	CNIVersion string    `json:"cniVersion,omitempty"`
	IP4        *IPConfig `json:"ip4,omitempty"`
	IP6        *IPConfig `json:"ip6,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)

GetResult converts the given Result object to the ImplementedSpecVersion and returns the concrete type or an error

func (*Result) GetAsVersion

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

func (*Result) Print

func (r *Result) Print() error

func (*Result) PrintTo

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

func (*Result) Version

func (r *Result) Version() string

Source Files

types.go

Version
v1.3.0 (latest)
Published
Apr 7, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
6 days ago

Tools for package owners.