libnetwork

package
v27.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 78 Imported by: 0

README

libnetwork - networking for containers

Libnetwork provides a native Go implementation for connecting containers

The goal of libnetwork is to deliver a robust Container Network Model that provides a consistent programming interface and the required network abstractions for applications.

Design

Please refer to the design for more information.

Using libnetwork

There are many networking solutions available to suit a broad range of use-cases. libnetwork uses a driver / plugin model to support all of these solutions while abstracting the complexity of the driver implementations by exposing a simple and consistent Network Model to users.

Contributing

Want to hack on libnetwork? Docker's contributions guidelines apply.

Code and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.

Documentation

Overview

Package libnetwork provides the basic functionality and extension points to create network namespaces and allocate interfaces for containers to use.

networkType := "bridge"

// Create a new controller instance
driverOptions := options.Generic{}
genericOption := make(map[string]interface{})
genericOption[netlabel.GenericData] = driverOptions
controller, err := libnetwork.New(config.OptionDriverConfig(networkType, genericOption))
if err != nil {
	return
}

// Create a network for containers to join.
// NewNetwork accepts Variadic optional arguments that libnetwork and Drivers can make use of
network, err := controller.NewNetwork(networkType, "network1", "")
if err != nil {
	return
}

// For each new container: allocate IP and interfaces. The returned network
// settings will be used for container infos (inspect and such), as well as
// iptables rules for port publishing. This info is contained or accessible
// from the returned endpoint.
ep, err := network.CreateEndpoint(context.TODO(), "Endpoint1")
if err != nil {
	return
}

// Create the sandbox for the container.
// NewSandbox accepts Variadic optional arguments which libnetwork can use.
sbx, err := controller.NewSandbox("container1",
	libnetwork.OptionHostname("test"),
	libnetwork.OptionDomainname("example.com"))

// A sandbox can join the endpoint via the join api.
err = ep.Join(sbx)
if err != nil {
	return
}

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthAgent        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAgent          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAgent = fmt.Errorf("proto: unexpected end of group")
)
View Source
var PortConfig_Protocol_name = map[int32]string{
	0: "TCP",
	1: "UDP",
	2: "SCTP",
}
View Source
var PortConfig_Protocol_value = map[string]int32{
	"TCP":  0,
	"UDP":  1,
	"SCTP": 2,
}

Functions

func NetworkDeleteOptionRemoveLB

func NetworkDeleteOptionRemoveLB(p *networkDeleteParams)

NetworkDeleteOptionRemoveLB informs a Network.Delete() operation that should remove the load balancer endpoint for this network. Note that the Delete() method will automatically remove a load balancing endpoint for most networks when the network is otherwise empty. However, this does not occur for some networks. In particular, networks marked as ingress (which are supposed to be more permanent than other overlay networks) won't automatically remove the LB endpoint on Delete(). This method allows for explicit removal of such networks provided there are no other endpoints present in the network. If the network still has non-LB endpoints present, Delete() will not remove the LB endpoint and will return an error.

Types

type ActiveContainerError

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

ActiveContainerError is returned when an endpoint is deleted which has active containers attached to it.

func (*ActiveContainerError) Error

func (ace *ActiveContainerError) Error() string

func (*ActiveContainerError) Forbidden

func (ace *ActiveContainerError) Forbidden()

Forbidden denotes the type of this error

type ActiveEndpointsError

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

ActiveEndpointsError is returned when a network is deleted which has active endpoints in it.

func (*ActiveEndpointsError) Error

func (aee *ActiveEndpointsError) Error() string

func (*ActiveEndpointsError) Forbidden

func (aee *ActiveEndpointsError) Forbidden()

Forbidden denotes the type of this error

type ByNetworkType

type ByNetworkType []*Endpoint

ByNetworkType sorts a Endpoint slice based on the network-type they're attached to. It implements sort.Interface and can be used with sort.Stable or sort.Sort. It is used by Sandbox.ResolveName when resolving names in swarm mode. In swarm mode, services with exposed ports are connected to user overlay network, ingress network, and local ("docker_gwbridge") networks. Name resolution should prioritize returning the VIP/IPs on user overlay network over ingress and local networks.

ByNetworkType re-orders the endpoints based on the network-type they are attached to:

  1. dynamic networks (user overlay networks)
  2. ingress network(s)
  3. local networks ("docker_gwbridge")

func (ByNetworkType) Len

func (ep ByNetworkType) Len() int

func (ByNetworkType) Less

func (ep ByNetworkType) Less(i, j int) bool

func (ByNetworkType) Swap

func (ep ByNetworkType) Swap(i, j int)

type ByTime

type ByTime []*types.EncryptionKey

ByTime implements sort.Interface for []*types.EncryptionKey based on the LamportTime field.

func (ByTime) Len

func (b ByTime) Len() int

func (ByTime) Less

func (b ByTime) Less(i, j int) bool

func (ByTime) Swap

func (b ByTime) Swap(i, j int)

type Controller

type Controller struct {
	DiagnosticServer *diagnostic.Server
	// contains filtered or unexported fields
}

Controller manages networks.

func New

func New(cfgOptions ...config.Option) (*Controller, error)

New creates a new instance of network controller.

func (*Controller) AgentInitWait

func (c *Controller) AgentInitWait()

AgentInitWait waits for agent initialization to be completed in the controller.

func (*Controller) AgentStopWait

func (c *Controller) AgentStopWait()

AgentStopWait waits for the Agent stop to be completed in the controller.

func (*Controller) BuiltinDrivers

func (c *Controller) BuiltinDrivers() []string

BuiltinDrivers returns the list of builtin network drivers.

func (*Controller) BuiltinIPAMDrivers

func (c *Controller) BuiltinIPAMDrivers() []string

BuiltinIPAMDrivers returns the list of builtin ipam drivers.

func (*Controller) Config

func (c *Controller) Config() config.Config

Config returns the bootup configuration for the controller.

func (*Controller) GetPluginGetter

func (c *Controller) GetPluginGetter() plugingetter.PluginGetter

func (*Controller) GetSandbox

func (c *Controller) GetSandbox(containerID string) (*Sandbox, error)

GetSandbox returns the Sandbox which has the passed id.

It returns an ErrInvalidID when passing an invalid ID, or an types.NotFoundError if no Sandbox was found for the container.

func (*Controller) ID

func (c *Controller) ID() string

ID returns the controller's unique identity.

func (*Controller) IsDiagnosticEnabled

func (c *Controller) IsDiagnosticEnabled() bool

IsDiagnosticEnabled returns true if the diagnostic server is running.

func (*Controller) NetworkByID

func (c *Controller) NetworkByID(id string) (*Network, error)

NetworkByID returns the Network which has the passed id. If not found, the error ErrNoSuchNetwork is returned.

func (*Controller) NetworkByName

func (c *Controller) NetworkByName(name string) (*Network, error)

NetworkByName returns the Network which has the passed name. If not found, the error ErrNoSuchNetwork is returned.

func (*Controller) Networks

func (c *Controller) Networks(ctx context.Context) []*Network

Networks returns the list of Network(s) managed by this controller.

func (*Controller) NewNetwork

func (c *Controller) NewNetwork(networkType, name string, id string, options ...NetworkOption) (_ *Network, retErr error)

NewNetwork creates a new network of the specified network type. The options are network specific and modeled in a generic way.

func (*Controller) NewSandbox

func (c *Controller) NewSandbox(ctx context.Context, containerID string, options ...SandboxOption) (_ *Sandbox, retErr error)

NewSandbox creates a new sandbox for containerID.

func (*Controller) RegisterDriver

func (c *Controller) RegisterDriver(networkType string, driver driverapi.Driver, capability driverapi.Capability) error

func (*Controller) SandboxByID

func (c *Controller) SandboxByID(id string) (*Sandbox, error)

SandboxByID returns the Sandbox which has the passed id. If not found, a types.NotFoundError is returned.

func (*Controller) SandboxDestroy

func (c *Controller) SandboxDestroy(ctx context.Context, id string) error

SandboxDestroy destroys a sandbox given a container ID.

func (*Controller) SetClusterProvider

func (c *Controller) SetClusterProvider(provider cluster.Provider)

SetClusterProvider sets the cluster provider.

func (*Controller) SetKeys

func (c *Controller) SetKeys(keys []*types.EncryptionKey) error

SetKeys configures the encryption key for gossip and overlay data path.

func (*Controller) StartDiagnostic

func (c *Controller) StartDiagnostic(port int)

StartDiagnostic starts the network diagnostic server listening on port.

func (*Controller) Stop

func (c *Controller) Stop()

Stop stops the network controller.

func (*Controller) StopDiagnostic

func (c *Controller) StopDiagnostic()

StopDiagnostic stops the network diagnostic server.

func (*Controller) WalkNetworks

func (c *Controller) WalkNetworks(walker NetworkWalker)

WalkNetworks uses the provided function to walk the Network(s) managed by this controller.

type DNSBackend

type DNSBackend interface {
	// ResolveName resolves a service name to an IPv4 or IPv6 address by searching
	// the networks the sandbox is connected to. For IPv6 queries, second return
	// value will be true if the name exists in docker domain but doesn't have an
	// IPv6 address. Such queries shouldn't be forwarded to external nameservers.
	ResolveName(ctx context.Context, name string, iplen int) ([]net.IP, bool)
	// ResolveIP returns the service name for the passed in IP. IP is in reverse dotted
	// notation; the format used for DNS PTR records
	ResolveIP(ctx context.Context, name string) string
	// ResolveService returns all the backend details about the containers or hosts
	// backing a service. Its purpose is to satisfy an SRV query
	ResolveService(ctx context.Context, name string) ([]*net.SRV, []net.IP)
	// ExecFunc allows a function to be executed in the context of the backend
	// on behalf of the resolver.
	ExecFunc(f func()) error
	// NdotsSet queries the backends ndots dns option settings
	NdotsSet() bool
	// HandleQueryResp passes the name & IP from a response to the backend. backend
	// can use it to maintain any required state about the resolution
	HandleQueryResp(name string, ip net.IP)
}

DNSBackend represents a backend DNS resolver used for DNS name resolution. All the queries to the resolver are forwarded to the backend resolver.

type Endpoint

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

Endpoint represents a logical connection between a network and a sandbox.

func (*Endpoint) AddStaticRoute

func (ep *Endpoint) AddStaticRoute(destination *net.IPNet, routeType int, nextHop net.IP) error

AddStaticRoute adds a route to the sandbox. It may be used in addition to or instead of a default gateway (as above).

func (*Endpoint) AddTableEntry

func (ep *Endpoint) AddTableEntry(tableName, key string, value []byte) error

AddTableEntry adds a table entry to the gossip layer passing the table name, key and an opaque value.

func (*Endpoint) CopyTo

func (ep *Endpoint) CopyTo(o datastore.KVObject) error

func (*Endpoint) Delete

func (ep *Endpoint) Delete(ctx context.Context, force bool) error

Delete deletes and detaches this endpoint from the network.

func (*Endpoint) DisableGatewayService

func (ep *Endpoint) DisableGatewayService()

DisableGatewayService tells libnetwork not to provide Default GW for the container

func (*Endpoint) DriverInfo

func (ep *Endpoint) DriverInfo() (map[string]interface{}, error)

DriverInfo returns a collection of driver operational data related to this endpoint retrieved from the driver.

func (*Endpoint) Exists

func (ep *Endpoint) Exists() bool

func (*Endpoint) Gateway

func (ep *Endpoint) Gateway() net.IP

Gateway returns the IPv4 gateway assigned by the driver. This will only return a valid value if a container has joined the endpoint.

func (*Endpoint) GatewayIPv6

func (ep *Endpoint) GatewayIPv6() net.IP

GatewayIPv6 returns the IPv6 gateway assigned by the driver. This will only return a valid value if a container has joined the endpoint.

func (*Endpoint) ID

func (ep *Endpoint) ID() string

ID returns the system-generated id for this endpoint.

func (*Endpoint) Iface

func (ep *Endpoint) Iface() *EndpointInterface

Iface returns information about the interface which was assigned to the endpoint by the driver. This can be used after the endpoint has been created.

func (*Endpoint) Index

func (ep *Endpoint) Index() uint64

func (*Endpoint) Info

func (ep *Endpoint) Info() EndpointInfo

Info hydrates the endpoint and returns certain operational data belonging to this endpoint.

TODO(thaJeztah): make sure that Endpoint is always fully hydrated, and remove the EndpointInfo interface, and use Endpoint directly.

func (*Endpoint) InterfaceName

func (ep *Endpoint) InterfaceName() driverapi.InterfaceNameInfo

func (*Endpoint) Join

func (ep *Endpoint) Join(ctx context.Context, sb *Sandbox, options ...EndpointOption) error

Join joins the sandbox to the endpoint and populates into the sandbox the network resources allocated for the endpoint.

func (*Endpoint) Key

func (ep *Endpoint) Key() []string

endpoint Key structure : endpoint/network-id/endpoint-id

func (*Endpoint) KeyPrefix

func (ep *Endpoint) KeyPrefix() []string

func (*Endpoint) Leave

func (ep *Endpoint) Leave(ctx context.Context, sb *Sandbox) error

Leave detaches the network resources populated in the sandbox.

func (*Endpoint) Less

func (epi *Endpoint) Less(epj *Endpoint) bool

<=> Returns true if a < b, false if a > b and advances to next level if a == b epi.prio <=> epj.prio # 2 < 1 epi.gw <=> epj.gw # non-gw < gw epi.internal <=> epj.internal # non-internal < internal epi.joininfo <=> epj.joininfo # ipv6 < ipv4 epi.name <=> epj.name # bar < foo

func (*Endpoint) LoadBalancer

func (ep *Endpoint) LoadBalancer() bool

LoadBalancer returns whether the endpoint is the load balancer endpoint for the network.

func (*Endpoint) MarshalJSON

func (ep *Endpoint) MarshalJSON() ([]byte, error)

func (*Endpoint) Name

func (ep *Endpoint) Name() string

Name returns the name of this endpoint.

func (*Endpoint) Network

func (ep *Endpoint) Network() string

Network returns the name of the network to which this endpoint is attached.

func (*Endpoint) New

func (ep *Endpoint) New() datastore.KVObject

func (*Endpoint) Sandbox

func (ep *Endpoint) Sandbox() *Sandbox

Sandbox returns the attached sandbox if there, nil otherwise.

func (*Endpoint) SetGateway

func (ep *Endpoint) SetGateway(gw net.IP) error

SetGateway sets the default IPv4 gateway when a container joins the endpoint.

func (*Endpoint) SetGatewayIPv6

func (ep *Endpoint) SetGatewayIPv6(gw6 net.IP) error

SetGatewayIPv6 sets the default IPv6 gateway when a container joins the endpoint.

func (*Endpoint) SetIndex

func (ep *Endpoint) SetIndex(index uint64)

func (*Endpoint) SetValue

func (ep *Endpoint) SetValue(value []byte) error

func (*Endpoint) Skip

func (ep *Endpoint) Skip() bool

func (*Endpoint) StaticRoutes

func (ep *Endpoint) StaticRoutes() []*types.StaticRoute

StaticRoutes returns the list of static routes configured by the network driver when the container joins a network

func (*Endpoint) UnmarshalJSON

func (ep *Endpoint) UnmarshalJSON(b []byte) (err error)

func (*Endpoint) UpdateDNSNames

func (ep *Endpoint) UpdateDNSNames(dnsNames []string) error

func (*Endpoint) Value

func (ep *Endpoint) Value() []byte

type EndpointInfo

type EndpointInfo interface {
	// Iface returns information about the interface which was assigned to
	// the endpoint by the driver. This can be used after the
	// endpoint has been created.
	Iface() *EndpointInterface

	// Gateway returns the IPv4 gateway assigned by the driver.
	// This will only return a valid value if a container has joined the endpoint.
	Gateway() net.IP

	// GatewayIPv6 returns the IPv6 gateway assigned by the driver.
	// This will only return a valid value if a container has joined the endpoint.
	GatewayIPv6() net.IP

	// StaticRoutes returns the list of static routes configured by the network
	// driver when the container joins a network
	StaticRoutes() []*types.StaticRoute

	// Sandbox returns the attached sandbox if there, nil otherwise.
	Sandbox() *Sandbox

	// LoadBalancer returns whether the endpoint is the load balancer endpoint for the network.
	LoadBalancer() bool
}

EndpointInfo provides an interface to retrieve network resources bound to the endpoint.

type EndpointInterface

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

EndpointInterface holds interface addresses bound to the endpoint.

func (*EndpointInterface) Address

func (epi *EndpointInterface) Address() *net.IPNet

Address returns the IPv4 address assigned to the endpoint.

func (*EndpointInterface) AddressIPv6

func (epi *EndpointInterface) AddressIPv6() *net.IPNet

AddressIPv6 returns the IPv6 address assigned to the endpoint.

func (*EndpointInterface) CopyTo

func (epi *EndpointInterface) CopyTo(dstEpi *EndpointInterface) error

func (*EndpointInterface) LinkLocalAddresses

func (epi *EndpointInterface) LinkLocalAddresses() []*net.IPNet

LinkLocalAddresses returns the list of link-local (IPv4/IPv6) addresses assigned to the endpoint.

func (*EndpointInterface) MacAddress

func (epi *EndpointInterface) MacAddress() net.HardwareAddr

MacAddress returns the MAC address assigned to the endpoint.

func (*EndpointInterface) MarshalJSON

func (epi *EndpointInterface) MarshalJSON() ([]byte, error)

func (*EndpointInterface) SetIPAddress

func (epi *EndpointInterface) SetIPAddress(address *net.IPNet) error

func (*EndpointInterface) SetMacAddress

func (epi *EndpointInterface) SetMacAddress(mac net.HardwareAddr) error

SetMacAddress allows the driver to set the mac address to the endpoint interface during the call to CreateEndpoint, if the mac address is not already set.

func (*EndpointInterface) SetNames

func (epi *EndpointInterface) SetNames(srcName string, dstPrefix string) error

SetNames method assigns the srcName and dstPrefix for the interface.

func (*EndpointInterface) SrcName

func (epi *EndpointInterface) SrcName() string

SrcName returns the name of the interface w/in the container

func (*EndpointInterface) UnmarshalJSON

func (epi *EndpointInterface) UnmarshalJSON(b []byte) error

type EndpointOption

type EndpointOption func(ep *Endpoint)

EndpointOption is an option setter function type used to pass various options to Network and Endpoint interfaces methods. The various setter functions of type EndpointOption are provided by libnetwork, they look like <Create|Join|Leave>Option[...](...)

func CreateOptionAlias

func CreateOptionAlias(name string, alias string) EndpointOption

CreateOptionAlias function returns an option setter for setting endpoint alias

func CreateOptionDNS

func CreateOptionDNS(dns []string) EndpointOption

CreateOptionDNS function returns an option setter for dns entry option to be passed to container Create method.

func CreateOptionDNSNames

func CreateOptionDNSNames(names []string) EndpointOption

CreateOptionDNSNames specifies the list of (non fully qualified) DNS names associated to an endpoint. These will be used to populate the embedded DNS server. Order matters: first name will be used to generate PTR records.

func CreateOptionDisableResolution

func CreateOptionDisableResolution() EndpointOption

CreateOptionDisableResolution function returns an option setter to indicate this endpoint doesn't want embedded DNS server functionality

func CreateOptionExposedPorts

func CreateOptionExposedPorts(exposedPorts []types.TransportPort) EndpointOption

CreateOptionExposedPorts function returns an option setter for the container exposed ports option to be passed to Network.CreateEndpoint method.

func CreateOptionIpam

func CreateOptionIpam(ipV4, ipV6 net.IP, llIPs []net.IP, ipamOptions map[string]string) EndpointOption

CreateOptionIpam function returns an option setter for the ipam configuration for this endpoint

func CreateOptionLoadBalancer

func CreateOptionLoadBalancer() EndpointOption

CreateOptionLoadBalancer function returns an option setter for denoting the endpoint is a load balancer for a network

func CreateOptionPortMapping

func CreateOptionPortMapping(portBindings []types.PortBinding) EndpointOption

CreateOptionPortMapping function returns an option setter for the mapping ports option to be passed to Network.CreateEndpoint method.

func CreateOptionService

func CreateOptionService(name, id string, vip net.IP, ingressPorts []*PortConfig, aliases []string) EndpointOption

CreateOptionService function returns an option setter for setting service binding configuration

func EndpointOptionGeneric

func EndpointOptionGeneric(generic map[string]interface{}) EndpointOption

EndpointOptionGeneric function returns an option setter for a Generic option defined in a Dictionary of Key-Value pair

func JoinOptionPriority

func JoinOptionPriority(prio int) EndpointOption

JoinOptionPriority function returns an option setter for priority option to be passed to the endpoint.Join() method.

type EndpointRecord

type EndpointRecord struct {
	// Name of the container
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Service name of the service to which this endpoint belongs.
	ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
	// Service ID of the service to which this endpoint belongs.
	ServiceID string `protobuf:"bytes,3,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	// Virtual IP of the service to which this endpoint belongs.
	VirtualIP string `protobuf:"bytes,4,opt,name=virtual_ip,json=virtualIp,proto3" json:"virtual_ip,omitempty"`
	// IP assigned to this endpoint.
	EndpointIP string `protobuf:"bytes,5,opt,name=endpoint_ip,json=endpointIp,proto3" json:"endpoint_ip,omitempty"`
	// IngressPorts exposed by the service to which this endpoint belongs.
	IngressPorts []*PortConfig `protobuf:"bytes,6,rep,name=ingress_ports,json=ingressPorts,proto3" json:"ingress_ports,omitempty"`
	// A list of aliases which are alternate names for the service
	Aliases []string `protobuf:"bytes,7,rep,name=aliases,proto3" json:"aliases,omitempty"`
	// List of aliases task specific aliases
	TaskAliases []string `protobuf:"bytes,8,rep,name=task_aliases,json=taskAliases,proto3" json:"task_aliases,omitempty"`
	// Whether this enpoint's service has been disabled
	ServiceDisabled bool `protobuf:"varint,9,opt,name=service_disabled,json=serviceDisabled,proto3" json:"service_disabled,omitempty"`
}

EndpointRecord specifies all the endpoint specific information that needs to gossiped to nodes participating in the network.

func (*EndpointRecord) Descriptor

func (*EndpointRecord) Descriptor() ([]byte, []int)

func (*EndpointRecord) GetAliases

func (m *EndpointRecord) GetAliases() []string

func (*EndpointRecord) GetEndpointIP

func (m *EndpointRecord) GetEndpointIP() string

func (*EndpointRecord) GetIngressPorts

func (m *EndpointRecord) GetIngressPorts() []*PortConfig

func (*EndpointRecord) GetName

func (m *EndpointRecord) GetName() string

func (*EndpointRecord) GetServiceDisabled

func (m *EndpointRecord) GetServiceDisabled() bool

func (*EndpointRecord) GetServiceID

func (m *EndpointRecord) GetServiceID() string

func (*EndpointRecord) GetServiceName

func (m *EndpointRecord) GetServiceName() string

func (*EndpointRecord) GetTaskAliases

func (m *EndpointRecord) GetTaskAliases() []string

func (*EndpointRecord) GetVirtualIP

func (m *EndpointRecord) GetVirtualIP() string

func (*EndpointRecord) GoString

func (this *EndpointRecord) GoString() string

func (*EndpointRecord) Marshal

func (m *EndpointRecord) Marshal() (dAtA []byte, err error)

func (*EndpointRecord) MarshalTo

func (m *EndpointRecord) MarshalTo(dAtA []byte) (int, error)

func (*EndpointRecord) MarshalToSizedBuffer

func (m *EndpointRecord) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EndpointRecord) ProtoMessage

func (*EndpointRecord) ProtoMessage()

func (*EndpointRecord) Reset

func (m *EndpointRecord) Reset()

func (*EndpointRecord) Size

func (m *EndpointRecord) Size() (n int)

func (*EndpointRecord) String

func (this *EndpointRecord) String() string

func (*EndpointRecord) Unmarshal

func (m *EndpointRecord) Unmarshal(dAtA []byte) error

func (*EndpointRecord) XXX_DiscardUnknown

func (m *EndpointRecord) XXX_DiscardUnknown()

func (*EndpointRecord) XXX_Marshal

func (m *EndpointRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EndpointRecord) XXX_Merge

func (m *EndpointRecord) XXX_Merge(src proto.Message)

func (*EndpointRecord) XXX_Size

func (m *EndpointRecord) XXX_Size() int

func (*EndpointRecord) XXX_Unmarshal

func (m *EndpointRecord) XXX_Unmarshal(b []byte) error

type EndpointWalker

type EndpointWalker func(ep *Endpoint) bool

EndpointWalker is a client provided function which will be used to walk the Endpoints. When the function returns true, the walk will stop.

type ErrInvalidID

type ErrInvalidID string

ErrInvalidID is returned when a query-by-id method is being invoked with an empty id parameter

func (ErrInvalidID) Error

func (ii ErrInvalidID) Error() string

func (ErrInvalidID) InvalidParameter

func (ii ErrInvalidID) InvalidParameter()

InvalidParameter denotes the type of this error

type ErrInvalidName

type ErrInvalidName string

ErrInvalidName is returned when a query-by-name or resource create method is invoked with an empty name parameter

func (ErrInvalidName) Error

func (in ErrInvalidName) Error() string

func (ErrInvalidName) InvalidParameter

func (in ErrInvalidName) InvalidParameter()

InvalidParameter denotes the type of this error

type ErrNoSuchEndpoint

type ErrNoSuchEndpoint string

ErrNoSuchEndpoint is returned when an endpoint query finds no result

func (ErrNoSuchEndpoint) Error

func (nse ErrNoSuchEndpoint) Error() string

func (ErrNoSuchEndpoint) NotFound

func (nse ErrNoSuchEndpoint) NotFound()

NotFound denotes the type of this error

type ErrNoSuchNetwork

type ErrNoSuchNetwork string

ErrNoSuchNetwork is returned when a network query finds no result

func (ErrNoSuchNetwork) Error

func (nsn ErrNoSuchNetwork) Error() string

func (ErrNoSuchNetwork) NotFound

func (nsn ErrNoSuchNetwork) NotFound()

NotFound denotes the type of this error

type IpamConf

type IpamConf struct {
	// PreferredPool is the master address pool for containers and network interfaces.
	PreferredPool string
	// SubPool is a subset of the master pool. If specified,
	// this becomes the container pool for automatic address allocations.
	SubPool string
	// Gateway is the preferred Network Gateway address (optional).
	Gateway string
	// AuxAddresses contains auxiliary addresses for network driver. Must be within the master pool.
	// libnetwork will reserve them if they fall into the container pool.
	AuxAddresses map[string]string
}

IpamConf contains all the ipam related configurations for a network

TODO(aker): use proper net/* structs instead of string literals.

func (*IpamConf) Contains

func (c *IpamConf) Contains(addr net.IP) bool

Contains checks whether the ipam master address pool contains [addr].

func (*IpamConf) CopyTo

func (c *IpamConf) CopyTo(dstC *IpamConf) error

CopyTo deep copies to the destination IpamConfig

func (*IpamConf) IsStatic

func (c *IpamConf) IsStatic() bool

IsStatic checks whether the subnet was statically allocated (ie. user-defined).

func (*IpamConf) Validate

func (c *IpamConf) Validate() error

Validate checks whether the configuration is valid

type IpamInfo

type IpamInfo struct {
	PoolID string
	Meta   map[string]string
	driverapi.IPAMData
}

IpamInfo contains all the ipam related operational info for a network

func (*IpamInfo) CopyTo

func (i *IpamInfo) CopyTo(dstI *IpamInfo) error

CopyTo deep copies to the destination IpamInfo

func (*IpamInfo) MarshalJSON

func (i *IpamInfo) MarshalJSON() ([]byte, error)

MarshalJSON encodes IpamInfo into json message

func (*IpamInfo) UnmarshalJSON

func (i *IpamInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes json message into PoolData

type ManagerRedirectError

type ManagerRedirectError string

ManagerRedirectError is returned when the request should be redirected to Manager

func (ManagerRedirectError) Error

func (mr ManagerRedirectError) Error() string

func (ManagerRedirectError) Maskable

func (mr ManagerRedirectError) Maskable()

Maskable denotes the type of this error

type Network

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

Network represents a logical connectivity zone that containers may join using the Link method. A network is managed by a specific driver.

func (*Network) Attachable

func (n *Network) Attachable() bool

func (*Network) ConfigFrom

func (n *Network) ConfigFrom() string

func (*Network) ConfigOnly

func (n *Network) ConfigOnly() bool

func (*Network) CopyTo

func (n *Network) CopyTo(o datastore.KVObject) error

func (*Network) CreateEndpoint

func (n *Network) CreateEndpoint(ctx context.Context, name string, options ...EndpointOption) (*Endpoint, error)

CreateEndpoint creates a new endpoint to this network symbolically identified by the specified unique name. The options parameter carries driver specific options.

func (*Network) Created

func (n *Network) Created() time.Time

func (*Network) Delete

func (n *Network) Delete(options ...NetworkDeleteOption) error

Delete the network.

func (*Network) DriverOptions

func (n *Network) DriverOptions() map[string]string

func (*Network) Dynamic

func (n *Network) Dynamic() bool

func (*Network) EndpointByID

func (n *Network) EndpointByID(id string) (*Endpoint, error)

EndpointByID should *never* be called as it's going to create a 2nd instance of an Endpoint. The first one lives in the Sandbox the endpoint is attached to. Instead, the endpoint should be retrieved by calling [Sandbox.Endpoints()].

func (*Network) EndpointByName

func (n *Network) EndpointByName(name string) (*Endpoint, error)

EndpointByName returns the Endpoint which has the passed name. If not found, the error ErrNoSuchEndpoint is returned.

func (*Network) Endpoints

func (n *Network) Endpoints() []*Endpoint

Endpoints returns the list of Endpoint(s) in this network.

func (*Network) Exists

func (n *Network) Exists() bool

func (*Network) HandleQueryResp

func (n *Network) HandleQueryResp(name string, ip net.IP)

func (*Network) ID

func (n *Network) ID() string

ID returns a system generated id for this network.

func (*Network) IPv6Enabled

func (n *Network) IPv6Enabled() bool

func (*Network) Index

func (n *Network) Index() uint64

func (*Network) Ingress

func (n *Network) Ingress() bool

func (*Network) Internal

func (n *Network) Internal() bool

func (*Network) IpamConfig

func (n *Network) IpamConfig() (ipamType string, ipamOptions map[string]string, ipamV4Config []*IpamConf, ipamV6Config []*IpamConf)

func (*Network) IpamInfo

func (n *Network) IpamInfo() (ipamV4Info []*IpamInfo, ipamV6Info []*IpamInfo)

func (*Network) Key

func (n *Network) Key() []string

func (*Network) KeyPrefix

func (n *Network) KeyPrefix() []string

func (*Network) Labels

func (n *Network) Labels() map[string]string

func (*Network) MarshalJSON

func (n *Network) MarshalJSON() ([]byte, error)

TODO : Can be made much more generic with the help of reflection (but has some golang limitations)

func (*Network) Name

func (n *Network) Name() string

Name returns a user chosen name for this network.

func (*Network) NdotsSet

func (n *Network) NdotsSet() bool

func (*Network) New

func (n *Network) New() datastore.KVObject

func (*Network) Peers

func (n *Network) Peers() []networkdb.PeerInfo

Peers returns a slice of PeerInfo structures which has the information about the peer nodes participating in the same overlay network. This is currently the per-network gossip cluster. For non-dynamic overlay networks and bridge networks it returns an empty slice

func (*Network) ResolveIP

func (n *Network) ResolveIP(_ context.Context, ip string) string

func (*Network) ResolveName

func (n *Network) ResolveName(ctx context.Context, req string, ipType int) ([]net.IP, bool)

func (*Network) ResolveService

func (n *Network) ResolveService(ctx context.Context, name string) ([]*net.SRV, []net.IP)

func (*Network) Resolvers

func (n *Network) Resolvers() []*Resolver

func (*Network) Scope

func (n *Network) Scope() string

func (*Network) Services

func (n *Network) Services() map[string]ServiceInfo

Services returns a map of services keyed by the service name with the details of all the tasks that belong to the service. Applicable only in swarm mode.

func (*Network) SetIndex

func (n *Network) SetIndex(index uint64)

func (*Network) SetValue

func (n *Network) SetValue(value []byte) error

func (*Network) Skip

func (n *Network) Skip() bool

func (*Network) TableEventRegister

func (n *Network) TableEventRegister(tableName string, objType driverapi.ObjectType) error

func (*Network) Type

func (n *Network) Type() string

Type returns the type of network, which corresponds to its managing driver.

func (*Network) UnmarshalJSON

func (n *Network) UnmarshalJSON(b []byte) (err error)

TODO : Can be made much more generic with the help of reflection (but has some golang limitations)

func (*Network) UpdateIpamConfig

func (n *Network) UpdateIpamConfig(ipV4Data []driverapi.IPAMData)

func (*Network) Value

func (n *Network) Value() []byte

func (*Network) WalkEndpoints

func (n *Network) WalkEndpoints(walker EndpointWalker)

WalkEndpoints uses the provided function to walk the Endpoints.

type NetworkDeleteOption

type NetworkDeleteOption func(p *networkDeleteParams)

NetworkDeleteOption is a type for optional parameters to pass to the Network.Delete() function.

type NetworkNameError

type NetworkNameError string

NetworkNameError is returned when a network with the same name already exists.

func (NetworkNameError) Conflict

func (nnr NetworkNameError) Conflict()

Conflict denotes the type of this error

func (NetworkNameError) Error

func (nnr NetworkNameError) Error() string

type NetworkOption

type NetworkOption func(n *Network)

NetworkOption is an option setter function type used to pass various options to NewNetwork method. The various setter functions of type NetworkOption are provided by libnetwork, they look like NetworkOptionXXXX(...)

func NetworkOptionAttachable

func NetworkOptionAttachable(attachable bool) NetworkOption

NetworkOptionAttachable returns an option setter to set attachable for a network

func NetworkOptionConfigFrom

func NetworkOptionConfigFrom(name string) NetworkOption

NetworkOptionConfigFrom tells controller to pick the network configuration from a configuration only network

func NetworkOptionConfigOnly

func NetworkOptionConfigOnly() NetworkOption

NetworkOptionConfigOnly tells controller this network is a configuration only network. It serves as a configuration for other networks.

func NetworkOptionDeferIPv6Alloc

func NetworkOptionDeferIPv6Alloc(enable bool) NetworkOption

NetworkOptionDeferIPv6Alloc instructs the network to defer the IPV6 address allocation until after the endpoint has been created It is being provided to support the specific docker daemon flags where user can deterministically assign an IPv6 address to a container as combination of fixed-cidr-v6 + mac-address TODO: Remove this option setter once we support endpoint ipam options

func NetworkOptionDriverOpts

func NetworkOptionDriverOpts(opts map[string]string) NetworkOption

NetworkOptionDriverOpts function returns an option setter for any driver parameter described by a map

func NetworkOptionDynamic

func NetworkOptionDynamic() NetworkOption

NetworkOptionDynamic function returns an option setter for dynamic option for a network

func NetworkOptionEnableIPv6

func NetworkOptionEnableIPv6(enableIPv6 bool) NetworkOption

NetworkOptionEnableIPv6 returns an option setter to explicitly configure IPv6

func NetworkOptionGeneric

func NetworkOptionGeneric(generic map[string]interface{}) NetworkOption

NetworkOptionGeneric function returns an option setter for a Generic option defined in a Dictionary of Key-Value pair

func NetworkOptionIngress

func NetworkOptionIngress(ingress bool) NetworkOption

NetworkOptionIngress returns an option setter to indicate if a network is an ingress network.

func NetworkOptionInternalNetwork

func NetworkOptionInternalNetwork() NetworkOption

NetworkOptionInternalNetwork returns an option setter to config the network to be internal which disables default gateway service

func NetworkOptionIpam

func NetworkOptionIpam(ipamDriver string, addrSpace string, ipV4 []*IpamConf, ipV6 []*IpamConf, opts map[string]string) NetworkOption

NetworkOptionIpam function returns an option setter for the ipam configuration for this network

func NetworkOptionLBEndpoint

func NetworkOptionLBEndpoint(ip net.IP) NetworkOption

NetworkOptionLBEndpoint function returns an option setter for the configuration of the load balancer endpoint for this network

func NetworkOptionLabels

func NetworkOptionLabels(labels map[string]string) NetworkOption

NetworkOptionLabels function returns an option setter for labels specific to a network

func NetworkOptionPersist

func NetworkOptionPersist(persist bool) NetworkOption

NetworkOptionPersist returns an option setter to set persistence policy for a network

func NetworkOptionScope

func NetworkOptionScope(scope string) NetworkOption

NetworkOptionScope returns an option setter to overwrite the network's scope. By default the network's scope is set to the network driver's datascope.

type NetworkWalker

type NetworkWalker func(nw *Network) bool

NetworkWalker is a client provided function which will be used to walk the Networks. When the function returns true, the walk will stop.

type PortConfig

type PortConfig struct {
	// Name for the port. If provided the port information can
	// be queried using the name as in a DNS SRV query.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Protocol for the port which is exposed.
	Protocol PortConfig_Protocol `protobuf:"varint,2,opt,name=protocol,proto3,enum=libnetwork.PortConfig_Protocol" json:"protocol,omitempty"`
	// The port which the application is exposing and is bound to.
	TargetPort uint32 `protobuf:"varint,3,opt,name=target_port,json=targetPort,proto3" json:"target_port,omitempty"`
	// PublishedPort specifies the port on which the service is
	// exposed on all nodes on the cluster. If not specified an
	// arbitrary port in the node port range is allocated by the
	// system. If specified it should be within the node port
	// range and it should be available.
	PublishedPort uint32 `protobuf:"varint,4,opt,name=published_port,json=publishedPort,proto3" json:"published_port,omitempty"`
}

PortConfig specifies an exposed port which can be addressed using the given name. This can be later queried using a service discovery api or a DNS SRV query. The node port specifies a port that can be used to address this service external to the cluster by sending a connection request to this port to any node on the cluster.

func (*PortConfig) Descriptor

func (*PortConfig) Descriptor() ([]byte, []int)

func (*PortConfig) GetName

func (m *PortConfig) GetName() string

func (*PortConfig) GetProtocol

func (m *PortConfig) GetProtocol() PortConfig_Protocol

func (*PortConfig) GetPublishedPort

func (m *PortConfig) GetPublishedPort() uint32

func (*PortConfig) GetTargetPort

func (m *PortConfig) GetTargetPort() uint32

func (*PortConfig) GoString

func (this *PortConfig) GoString() string

func (*PortConfig) Marshal

func (m *PortConfig) Marshal() (dAtA []byte, err error)

func (*PortConfig) MarshalTo

func (m *PortConfig) MarshalTo(dAtA []byte) (int, error)

func (*PortConfig) MarshalToSizedBuffer

func (m *PortConfig) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PortConfig) ProtoMessage

func (*PortConfig) ProtoMessage()

func (*PortConfig) Reset

func (m *PortConfig) Reset()

func (*PortConfig) Size

func (m *PortConfig) Size() (n int)

func (*PortConfig) String

func (this *PortConfig) String() string

func (*PortConfig) Unmarshal

func (m *PortConfig) Unmarshal(dAtA []byte) error

func (*PortConfig) XXX_DiscardUnknown

func (m *PortConfig) XXX_DiscardUnknown()

func (*PortConfig) XXX_Marshal

func (m *PortConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PortConfig) XXX_Merge

func (m *PortConfig) XXX_Merge(src proto.Message)

func (*PortConfig) XXX_Size

func (m *PortConfig) XXX_Size() int

func (*PortConfig) XXX_Unmarshal

func (m *PortConfig) XXX_Unmarshal(b []byte) error

type PortConfig_Protocol

type PortConfig_Protocol int32
const (
	ProtocolTCP  PortConfig_Protocol = 0
	ProtocolUDP  PortConfig_Protocol = 1
	ProtocolSCTP PortConfig_Protocol = 2
)

func (PortConfig_Protocol) EnumDescriptor

func (PortConfig_Protocol) EnumDescriptor() ([]byte, []int)

func (PortConfig_Protocol) String

func (x PortConfig_Protocol) String() string

type Resolver

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

Resolver is the embedded DNS server in Docker. It operates by listening on the container's loopback interface for DNS queries.

func NewResolver

func NewResolver(address string, proxyDNS bool, backend DNSBackend) *Resolver

NewResolver creates a new instance of the Resolver

func (*Resolver) NameServer

func (r *Resolver) NameServer() netip.Addr

NameServer returns the IP of the DNS resolver for the containers.

func (*Resolver) ResolverOptions

func (r *Resolver) ResolverOptions() []string

ResolverOptions returns resolv.conf options that should be set.

func (*Resolver) SetExtServers

func (r *Resolver) SetExtServers(extDNS []extDNSEntry)

SetExtServers configures the external nameservers the resolver should use when forwarding queries, unless SetExtServersForSrc has configured servers for the DNS client making the request.

func (*Resolver) SetExtServersForSrc

func (r *Resolver) SetExtServersForSrc(srcAddr netip.Addr, extDNS []extDNSEntry) error

SetExtServersForSrc configures the external nameservers the resolver should use when forwarding queries from srcAddr. If set, these servers will be used in preference to servers set by SetExtServers. Supplying a nil or empty extDNS deletes nameservers for srcAddr.

func (*Resolver) SetForwardingPolicy

func (r *Resolver) SetForwardingPolicy(policy bool)

SetForwardingPolicy re-configures the embedded DNS resolver to either enable or disable forwarding DNS queries to external servers.

func (*Resolver) SetupFunc

func (r *Resolver) SetupFunc(port uint16) func()

SetupFunc returns the setup function that should be run in the container's network namespace.

func (*Resolver) Start

func (r *Resolver) Start() error

Start starts the name server for the container.

func (*Resolver) Stop

func (r *Resolver) Stop()

Stop stops the name server for the container. A stopped resolver can be reused after running the SetupFunc again.

type Sandbox

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

Sandbox provides the control over the network container entity. It is a one to one mapping with the container.

func (*Sandbox) ContainerID

func (sb *Sandbox) ContainerID() string

ContainerID returns the container id associated to this sandbox.

func (*Sandbox) Delete

func (sb *Sandbox) Delete(ctx context.Context) error

Delete destroys this container after detaching it from all connected endpoints.

func (*Sandbox) DisableService

func (sb *Sandbox) DisableService() (err error)

DisableService removes a managed container's endpoints from the load balancer and service discovery.

func (*Sandbox) EnableService

func (sb *Sandbox) EnableService() (err error)

EnableService makes a managed container's service available by adding the endpoint to the service load balancer and service discovery.

func (*Sandbox) Endpoints

func (sb *Sandbox) Endpoints() []*Endpoint

Endpoints returns all the endpoints connected to the sandbox.

func (*Sandbox) ExecFunc

func (sb *Sandbox) ExecFunc(f func()) error

func (*Sandbox) FinishConfig

func (sb *Sandbox) FinishConfig(ctx context.Context) error

FinishConfig completes Sandbox configuration. If called after the container task has been created, and sysctl settings applied, the configuration will be based on the container's IPv6 support.

func (*Sandbox) GetEndpoint

func (sb *Sandbox) GetEndpoint(id string) *Endpoint

func (*Sandbox) HandleQueryResp

func (sb *Sandbox) HandleQueryResp(name string, ip net.IP)

func (*Sandbox) ID

func (sb *Sandbox) ID() string

ID returns the ID of the sandbox.

func (*Sandbox) Key

func (sb *Sandbox) Key() string

Key returns the sandbox's key.

func (*Sandbox) Labels

func (sb *Sandbox) Labels() map[string]interface{}

Labels returns the sandbox's labels.

func (*Sandbox) MarshalJSON

func (sb *Sandbox) MarshalJSON() ([]byte, error)

func (*Sandbox) NdotsSet

func (sb *Sandbox) NdotsSet() bool

func (*Sandbox) Refresh

func (sb *Sandbox) Refresh(ctx context.Context, options ...SandboxOption) error

Refresh leaves all the endpoints, resets and re-applies the options, re-joins all the endpoints without destroying the osl sandbox

func (*Sandbox) Rename

func (sb *Sandbox) Rename(name string) error

Rename changes the name of all attached Endpoints.

func (*Sandbox) ResolveIP

func (sb *Sandbox) ResolveIP(ctx context.Context, ip string) string

func (*Sandbox) ResolveName

func (sb *Sandbox) ResolveName(ctx context.Context, name string, ipType int) ([]net.IP, bool)

func (*Sandbox) ResolveService

func (sb *Sandbox) ResolveService(ctx context.Context, name string) ([]*net.SRV, []net.IP)

ResolveService returns all the backend details about the containers or hosts backing a service. Its purpose is to satisfy an SRV query.

func (*Sandbox) SetKey

func (sb *Sandbox) SetKey(ctx context.Context, basePath string) error

SetKey updates the Sandbox Key.

func (*Sandbox) Statistics

func (sb *Sandbox) Statistics() (map[string]*types.InterfaceStatistics, error)

Statistics retrieves the interfaces' statistics for the sandbox.

func (*Sandbox) UnmarshalJSON

func (sb *Sandbox) UnmarshalJSON(b []byte) (err error)

type SandboxOption

type SandboxOption func(sb *Sandbox)

SandboxOption is an option setter function type used to pass various options to NewNetContainer method. The various setter functions of type SandboxOption are provided by libnetwork, they look like ContainerOptionXXXX(...)

func OptionDNS

func OptionDNS(dns []string) SandboxOption

OptionDNS function returns an option setter for dns entry option to be passed to container Create method.

func OptionDNSOptions

func OptionDNSOptions(options []string) SandboxOption

OptionDNSOptions function returns an option setter for dns options entry option to be passed to container Create method.

func OptionDNSSearch

func OptionDNSSearch(search []string) SandboxOption

OptionDNSSearch function returns an option setter for dns search entry option to be passed to container Create method.

func OptionDomainname

func OptionDomainname(name string) SandboxOption

OptionDomainname function returns an option setter for domainname option to be passed to NewSandbox method.

func OptionExposedPorts

func OptionExposedPorts(exposedPorts []types.TransportPort) SandboxOption

OptionExposedPorts function returns an option setter for the container exposed ports option to be passed to container Create method.

func OptionExtraHost

func OptionExtraHost(name string, IP string) SandboxOption

OptionExtraHost function returns an option setter for extra /etc/hosts options which is a name and IP as strings.

func OptionGeneric

func OptionGeneric(generic map[string]interface{}) SandboxOption

OptionGeneric function returns an option setter for Generic configuration that is not managed by libNetwork but can be used by the Drivers during the call to net container creation method. Container Labels are a good example.

func OptionHostname

func OptionHostname(name string) SandboxOption

OptionHostname function returns an option setter for hostname option to be passed to NewSandbox method.

func OptionHostsPath

func OptionHostsPath(path string) SandboxOption

OptionHostsPath function returns an option setter for hostspath option to be passed to NewSandbox method.

func OptionIngress

func OptionIngress() SandboxOption

OptionIngress function returns an option setter for marking a sandbox as the controller's ingress sandbox.

func OptionLoadBalancer

func OptionLoadBalancer(nid string) SandboxOption

OptionLoadBalancer function returns an option setter for marking a sandbox as a load balancer sandbox.

func OptionOriginHostsPath

func OptionOriginHostsPath(path string) SandboxOption

OptionOriginHostsPath function returns an option setter for origin hosts file path to be passed to NewSandbox method.

func OptionOriginResolvConfPath

func OptionOriginResolvConfPath(path string) SandboxOption

OptionOriginResolvConfPath function returns an option setter to set the path to the origin resolv.conf file to be passed to net container methods.

func OptionParentUpdate

func OptionParentUpdate(cid string, name, ip string) SandboxOption

OptionParentUpdate function returns an option setter for parent container which needs to update the IP address for the linked container.

func OptionPortMapping

func OptionPortMapping(portBindings []types.PortBinding) SandboxOption

OptionPortMapping function returns an option setter for the mapping ports option to be passed to container Create method.

func OptionResolvConfPath

func OptionResolvConfPath(path string) SandboxOption

OptionResolvConfPath function returns an option setter for resolvconfpath option to be passed to net container methods.

func OptionUseDefaultSandbox

func OptionUseDefaultSandbox() SandboxOption

OptionUseDefaultSandbox function returns an option setter for using default sandbox (host namespace) to be passed to container Create method.

func OptionUseExternalKey

func OptionUseExternalKey() SandboxOption

OptionUseExternalKey function returns an option setter for using provided namespace instead of creating one.

type ServiceInfo

type ServiceInfo struct {
	VIP          string
	LocalLBIndex int
	Tasks        []Task
	Ports        []string
}

ServiceInfo has service specific details along with the list of backend tasks

type Task

type Task struct {
	Name       string
	EndpointID string
	EndpointIP string
	Info       map[string]string
}

Task has the backend container details

type UnknownNetworkError

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

UnknownNetworkError is returned when libnetwork could not find in its database a network with the same name and id.

func (*UnknownNetworkError) Error

func (une *UnknownNetworkError) Error() string

func (*UnknownNetworkError) NotFound

func (une *UnknownNetworkError) NotFound()

NotFound denotes the type of this error

Directories

Path Synopsis
Package bitmap provides a datatype for long vectors of bits.
Package bitmap provides a datatype for long vectors of bits.
cmd
drivers
overlay/overlayutils
Package overlayutils provides utility functions for overlay networks
Package overlayutils provides utility functions for overlay networks
remote/api
Package api represents all requests and responses suitable for conversation with a remote driver.
Package api represents all requests and responses suitable for conversation with a remote driver.
windows/overlay
Package overlay is a generated protocol buffer package.
Package overlay is a generated protocol buffer package.
internal
resolvconf
Package resolvconf is used to generate a container's /etc/resolv.conf file.
Package resolvconf is used to generate a container's /etc/resolv.conf file.
Package ipamapi specifies the contract the IPAM service (built-in or remote) needs to satisfy.
Package ipamapi specifies the contract the IPAM service (built-in or remote) needs to satisfy.
null
Package null implements the null ipam driver.
Package null implements the null ipam driver.
remote/api
Package api defines the data structure to be used in the request/response messages between libnetwork and the remote ipam plugin
Package api defines the data structure to be used in the request/response messages between libnetwork and the remote ipam plugin
Package ipamutils provides utility functions for ipam management
Package ipamutils provides utility functions for ipam management
Package ipbits contains utilities for manipulating [netip.Addr] values as numbers or bitfields.
Package ipbits contains utilities for manipulating [netip.Addr] values as numbers or bitfields.
Package netutils provides network utility functions.
Package netutils provides network utility functions.
Package options provides a way to pass unstructured sets of options to a component expecting a strongly-typed configuration structure.
Package options provides a way to pass unstructured sets of options to a component expecting a strongly-typed configuration structure.
osl
Package osl describes structures and interfaces which abstract os entities
Package osl describes structures and interfaces which abstract os entities
Package resolvconf provides utility code to query and update DNS configuration in /etc/resolv.conf
Package resolvconf provides utility code to query and update DNS configuration in /etc/resolv.conf
Package types contains types that are common across libnetwork project
Package types contains types that are common across libnetwork project

Jump to

Keyboard shortcuts

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