util

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptionsKeyGeneric = "com.docker.network.generic"
)

Variables

View Source
var (
	// ErrIPAM indicates an unsupported IPAM driver was used
	ErrIPAM = errors.New("only the null IPAM driver is supported")
	// ErrBridgeRequired indicates a network bridge was not provided for network creation
	ErrBridgeRequired = errors.New("bridge required")
	// ErrNotBridge indicates that the provided network interface is not a bridge
	ErrNotBridge = errors.New("network interface is not a bridge")
	// ErrBridgeUsed indicates that a bridge is already in use
	ErrBridgeUsed = errors.New("bridge already in use by Docker")
	// ErrMACAddress indicates an invalid MAC address
	ErrMACAddress = errors.New("invalid MAC address")
	// ErrNoLease indicates a DHCP lease was not obtained from udhcpc
	ErrNoLease = errors.New("udhcpc did not output a lease")
	// ErrNoHint indicates missing state from the CreateEndpoint stage in Join
	ErrNoHint = errors.New("missing CreateEndpoint hints")
	// ErrNotVEth indicates a host link was unexpectedly not a veth interface
	ErrNotVEth = errors.New("host link is not a veth interface")
	// ErrNoContainer indicates a container was unexpectedly not found
	ErrNoContainer = errors.New("couldn't find container by endpoint on the network")
	// ErrNoSandbox indicates missing state from the Join stage
	ErrNoSandbox = errors.New("missing joined endpoint state")
)

Functions

func AwaitCondition

func AwaitCondition(ctx context.Context, cond func() (bool, error), interval time.Duration) error

func AwaitContainerInspect

func AwaitContainerInspect(ctx context.Context, docker *client.Client, id string, interval time.Duration) (types.ContainerJSON, error)

func AwaitLinkByIndex

func AwaitLinkByIndex(ctx context.Context, handle *netlink.Handle, index int, interval time.Duration) (netlink.Link, error)

func AwaitNetNS

func AwaitNetNS(ctx context.Context, path string, interval time.Duration) (netns.NsHandle, error)

func ErrToStatus

func ErrToStatus(err error) int

func JSONErrResponse

func JSONErrResponse(w http.ResponseWriter, err error, statusCode int)

JSONErrResponse Sends an `error` as a JSON object with a `message` property

func JSONResponse

func JSONResponse(w http.ResponseWriter, v interface{}, statusCode int)

JSONResponse Sends a JSON payload in response to a HTTP request

func ParseJSONBody

func ParseJSONBody(v interface{}, w http.ResponseWriter, r *http.Request) error

ParseJSONBody attempts to parse the request body as JSON

func WriteAccessLog

func WriteAccessLog(w io.Writer, params handlers.LogFormatterParams)

Types

This section is empty.

Jump to

Keyboard shortcuts

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