dknet

package
v0.0.0-...-f58463c Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2017 License: MIT, Apache-2.0 Imports: 9 Imported by: 0

README

Docker network extension api.

Go handler to create external network extensions for Docker. Inspired by @calavera's awesome dkvolume library

Usage

This library is designed to be integrated in your program.

  1. Implement the dknet.Driver interface.
  2. Initialize a dknet.Handler with your implementation.
  3. Call either ServeTCP or ServeUnix from the dknet.Handler.
Example using TCP sockets:
  d := MyNetworkDriver{}
  h := dknet.NewHandler(d)
  h.ServeTCP("test_network", ":8080")
Example using Unix sockets:
  d := MyNetworkDriver{}
  h := dknet.NewHandler(d)
  h.ServeUnix("root", "test_network")

Full example plugins

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateEndpointRequest

type CreateEndpointRequest struct {
	NetworkID  string
	EndpointID string
	Interface  *EndpointInterface
	Options    map[string]interface{}
}

type CreateNetworkRequest

type CreateNetworkRequest struct {
	NetworkID string
	Options   map[string]interface{}
	IPv4Data  []*IPAMData
	IPv6Data  []*IPAMData
}

type DeleteEndpointRequest

type DeleteEndpointRequest struct {
	NetworkID  string
	EndpointID string
}

type DeleteNetworkRequest

type DeleteNetworkRequest struct {
	NetworkID string
}

type Driver

type Driver interface {
	CreateNetwork(*CreateNetworkRequest) error
	DeleteNetwork(*DeleteNetworkRequest) error
	CreateEndpoint(*CreateEndpointRequest) error
	DeleteEndpoint(*DeleteEndpointRequest) error
	EndpointInfo(*InfoRequest) (*InfoResponse, error)
	Join(*JoinRequest) (*JoinResponse, error)
	Leave(*LeaveRequest) error
}

Driver represent the interface a driver must fulfill.

type EndpointInterface

type EndpointInterface struct {
	Address     string
	AddressIPv6 string
	MacAddress  string
}

type Handler

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

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

func NewHandler

func NewHandler(driver Driver) *Handler

NewHandler initializes the request handler with a driver implementation.

func (*Handler) ServeTCP

func (h *Handler) ServeTCP(pluginName, addr string) error

ServeTCP makes the handler to listen for request in a given TCP address. It also writes the spec file on the right directory for docker to read.

func (*Handler) ServeUnix

func (h *Handler) ServeUnix(systemGroup, addr string) error

ServeUnix makes the handler to listen for requests in a unix socket. It also creates the socket file on the right directory for docker to read.

type IPAMData

type IPAMData struct {
	AddressSpace string
	Pool         string
	Gateway      string
	AuxAddresses map[string]interface{}
}

type InfoRequest

type InfoRequest struct {
	NetworkID string
	EnpointID string
}

type InfoResponse

type InfoResponse struct {
	Value map[string]string
}

type InterfaceName

type InterfaceName struct {
	SrcName   string
	DstPrefix string
}

type JoinRequest

type JoinRequest struct {
	NetworkID  string
	EndpointID string
	SandboxKey string
	Options    map[string]interface{}
}

type JoinResponse

type JoinResponse struct {
	Gateway       string
	InterfaceName InterfaceName
	StaticRoutes  []*StaticRoute
}

type LeaveRequest

type LeaveRequest struct {
	NetworkID  string
	EndpointID string
	Options    map[string]interface{}
}

type StaticRoute

type StaticRoute struct {
	Destination string
	RouteType   int
	NextHop     string
}

Jump to

Keyboard shortcuts

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