ipam

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 2

README

Docker IPAM extension API

Go handler to create external IPAM extensions for Docker.

Usage

This library is designed to be integrated in your program.

  1. Implement the ipam.Driver interface.
  2. Initialize a ipam.Handler with your implementation.
  3. Call either ServeTCP or ServeUnix from the ipam.Handler.
Example using TCP sockets:
  import "github.com/docker/go-plugins-helpers/ipam"

  d := MyIPAMDriver{}
  h := ipam.NewHandler(d)
  h.ServeTCP("test_ipam", ":8080")
Example using Unix sockets:
  import "github.com/docker/go-plugins-helpers/ipam"

  d := MyIPAMDriver{}
  h := ipam.NewHandler(d)
  h.ServeUnix("root", "test_ipam")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureHandler added in v1.2.0

func ConfigureHandler(sdkhandler sdk.Handler, driver Ipam)

ConfigureHandler adds routes to the sdk.Handler to handle the Ipam plugin API

Types

type AddressSpacesResponse

type AddressSpacesResponse struct {
	LocalDefaultAddressSpace  string
	GlobalDefaultAddressSpace string
}

AddressSpacesResponse returns the default local and global address space names for this IPAM

type CapabilitiesResponse

type CapabilitiesResponse struct {
	RequiresMACAddress bool
}

CapabilitiesResponse returns whether or not this IPAM required pre-made MAC

type ErrorResponse

type ErrorResponse struct {
	Err string
}

ErrorResponse is a formatted error message that libnetwork can understand

func NewErrorResponse

func NewErrorResponse(msg string) *ErrorResponse

NewErrorResponse creates an ErrorResponse with the provided message

type Handler

type Handler struct {
	sdk.Handler
	// contains filtered or unexported fields
}

Handler forwards requests and responses between the docker daemon and the plugin.

func NewHandler

func NewHandler(logger logrus.FieldLogger, driver Ipam) *Handler

NewHandler initializes the request handler with a driver implementation.

type Ipam

Ipam represent the interface a driver must fulfill.

type ReleaseAddressRequest

type ReleaseAddressRequest struct {
	PoolID  string
	Address string
}

ReleaseAddressRequest is sent in order to release an address from the pool

type ReleasePoolRequest

type ReleasePoolRequest struct {
	PoolID string
}

ReleasePoolRequest is sent when releasing a previously registered address pool

type RequestAddressRequest

type RequestAddressRequest struct {
	PoolID  string
	Address string
	Options map[string]string
}

RequestAddressRequest is sent when requesting an address from IPAM

type RequestAddressResponse

type RequestAddressResponse struct {
	Address string
	Data    map[string]string
}

RequestAddressResponse is formed with allocated address by IPAM

type RequestPoolRequest

type RequestPoolRequest struct {
	AddressSpace string
	Pool         string
	SubPool      string
	Options      map[string]string
	V6           bool
}

RequestPoolRequest is sent by the daemon when a pool needs to be created

type RequestPoolResponse

type RequestPoolResponse struct {
	PoolID string
	Pool   string
	Data   map[string]string
}

RequestPoolResponse returns a registered address pool with the IPAM driver

Jump to

Keyboard shortcuts

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