com

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const HTTPStatusErrorBodyMaxLength = 64 * 1024

HTTPStatusErrorBodyMaxLength specifies the maximum length of HTTPStatusError.Body

Variables

This section is empty.

Functions

func AddRoutes

func AddRoutes(r *mux.Router, b *Backend)

Types

type Backend

type Backend struct {
	BypassDriver BypassDriver
}

type BypassDriver

type BypassDriver interface {
	ListInterfaces() map[string]ContainerInterfaces
	GetInterface(id string) *ContainerInterfaces
	PostInterface(id string, containerIfs *ContainerInterfaces)
	DeleteInterface(id string)
}

type ComClient

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

func NewComClient

func NewComClient(socketPath string) (*ComClient, error)

func (*ComClient) DeleteInterface

func (c *ComClient) DeleteInterface(ctx context.Context, id string) error

func (*ComClient) GetInterface

func (c *ComClient) GetInterface(ctx context.Context, id string) (*ContainerInterfaces, error)

func (*ComClient) ListInterfaces

func (c *ComClient) ListInterfaces(ctx context.Context) (map[string]ContainerInterfaces, error)

func (*ComClient) Ping

func (c *ComClient) Ping(ctx context.Context) error

func (*ComClient) PostInterface

func (c *ComClient) PostInterface(ctx context.Context, ifs *ContainerInterfaces) (*ContainerInterfaces, error)

type ContainerInterfaces

type ContainerInterfaces struct {
	ContainerID string      `json:"containerID"`
	Interfaces  []Interface `json:"interfaces"`
	// key is "container-side" port, value is host-side port
	ForwardingPorts map[int]int `json:"forwardingPorts"`
}

type HTTPStatusError

type HTTPStatusError struct {
	// StatusCode is non-2XX status code
	StatusCode int
	// Body is at most HTTPStatusErrorBodyMaxLength
	Body string
}

HTTPStatusError is created from non-2XX HTTP response

func (*HTTPStatusError) Error

func (e *HTTPStatusError) Error() string

Error implements error. If e.Body is a marshalled string of api.ErrorJSON, Error returns ErrorJSON.Message . Otherwise Error returns a human-readable string that contains e.StatusCode and e.Body.

type Interface

type Interface struct {
	Name       string           `json:"name"`
	HWAddr     net.HardwareAddr `json:"hwAddr"`
	Addresses  []net.IPNet      `json:"addresses"`
	IsLoopback bool             `json:"isLoopback"`
}

Jump to

Keyboard shortcuts

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