plugin

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: 18 Imported by: 0

Documentation

Index

Constants

View Source
const CLIOptionsKey string = "com.docker.network.generic"

CLIOptionsKey is the key used in create network options by the CLI for custom options

View Source
const DriverName string = "net-dhcp"

DriverName is the name of the Docker Network Driver

Variables

This section is empty.

Functions

func IsDHCPPlugin

func IsDHCPPlugin(driver string) bool

IsDHCPPlugin checks if a Docker network driver is an instance of this plugin

Types

type CapabilitiesResponse

type CapabilitiesResponse struct {
	Scope             string
	ConnectivityScope string
}

CapabilitiesResponse returns whether or not this network is global or local

type CreateEndpointRequest

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

CreateEndpointRequest is sent by the daemon when an endpoint should be created

type CreateEndpointResponse

type CreateEndpointResponse struct {
	Interface *EndpointInterface
}

CreateEndpointResponse is sent as a response to a CreateEndpointRequest

type CreateNetworkRequest

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

CreateNetworkRequest is sent by the daemon when a network needs to be created

type DHCPNetworkOptions

type DHCPNetworkOptions struct {
	Bridge          string
	IPv6            bool
	LeaseTimeout    time.Duration `mapstructure:"lease_timeout"`
	IgnoreConflicts bool          `mapstructure:"ignore_conflicts"`
	SkipRoutes      bool          `mapstructure:"skip_routes"`
}

DHCPNetworkOptions contains options for the DHCP network driver

type DeleteEndpointRequest

type DeleteEndpointRequest struct {
	NetworkID  string
	EndpointID string
}

DeleteEndpointRequest is sent by the daemon when an endpoint needs to be removed

type DeleteNetworkRequest

type DeleteNetworkRequest struct {
	NetworkID string
}

DeleteNetworkRequest is sent by the daemon when a network needs to be removed

type EndpointInterface

type EndpointInterface struct {
	Address     string
	AddressIPv6 string
	MacAddress  string
}

EndpointInterface contains endpoint interface information

type IPAMData

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

IPAMData contains IPv4 or IPv6 addressing information

type InfoRequest

type InfoRequest struct {
	NetworkID  string
	EndpointID string
}

InfoRequest is sent by the daemon when querying endpoint information

type InfoResponse

type InfoResponse struct {
	Value map[string]string
}

InfoResponse is endpoint information sent in response to an InfoRequest

type InterfaceName

type InterfaceName struct {
	SrcName   string
	DstPrefix string
}

InterfaceName consists of the name of the interface in the global netns and the desired prefix to be appended to the interface inside the container netns

type JoinRequest

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

JoinRequest is sent by the Daemon when an endpoint needs be joined to a network

type JoinResponse

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

JoinResponse is sent in response to a JoinRequest

type LeaveRequest

type LeaveRequest struct {
	NetworkID  string
	EndpointID string
}

LeaveRequest is sent by the daemon when a endpoint is leaving a network

type Plugin

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

Plugin is the DHCP network plugin

func NewPlugin

func NewPlugin(awaitTimeout time.Duration) (*Plugin, error)

NewPlugin creates a new Plugin

func (*Plugin) Close

func (p *Plugin) Close() error

Close stops the plugin server

func (*Plugin) CreateEndpoint

CreateEndpoint creates a veth pair and uses udhcpc to acquire an initial IP address on the container end. Docker will move the interface into the container's namespace and apply the address.

func (*Plugin) CreateNetwork

func (p *Plugin) CreateNetwork(r CreateNetworkRequest) error

CreateNetwork "creates" a new DHCP network (just checks if the provided bridge exists and the null IPAM driver is used)

func (*Plugin) DeleteEndpoint

func (p *Plugin) DeleteEndpoint(r DeleteEndpointRequest) error

DeleteEndpoint deletes the veth pair

func (*Plugin) DeleteNetwork

func (p *Plugin) DeleteNetwork(r DeleteNetworkRequest) error

DeleteNetwork "deletes" a DHCP network (does nothing, the bridge is managed by the user)

func (*Plugin) EndpointOperInfo

func (p *Plugin) EndpointOperInfo(ctx context.Context, r InfoRequest) (InfoResponse, error)

EndpointOperInfo retrieves some info about an existing endpoint

func (*Plugin) Join

func (p *Plugin) Join(ctx context.Context, r JoinRequest) (JoinResponse, error)

Join passes the veth name and route information (gateway from DHCP and existing routes on the host bridge) to Docker and starts a persistent DHCP client to maintain the lease on the acquired IP

func (*Plugin) Leave

func (p *Plugin) Leave(ctx context.Context, r LeaveRequest) error

Leave stops the persistent DHCP client for an endpoint

func (*Plugin) Listen

func (p *Plugin) Listen(bindSock string) error

Listen starts the plugin server

type StaticRoute

type StaticRoute struct {
	Destination string
	RouteType   int
	NextHop     string
}

StaticRoute contains static route information

Jump to

Keyboard shortcuts

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