docker: github.com/docker/docker/vendor/github.com/docker/libnetwork Index | Files | Directories

package libnetwork

import "github.com/docker/docker/vendor/github.com/docker/libnetwork"

Package libnetwork is a generated protocol buffer package.

It is generated from these files:
	agent.proto

It has these top-level messages:
	EndpointRecord
	PortConfig

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("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("docker.io"))

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

Index

Package Files

agent.go agent.pb.go controller.go default_gateway.go default_gateway_linux.go drivers_ipam.go drivers_linux.go endpoint.go endpoint_cnt.go endpoint_info.go endpoint_info_unix.go error.go firewall_linux.go network.go network_unix.go resolver.go resolver_unix.go sandbox.go sandbox_dns_unix.go sandbox_externalkey.go sandbox_externalkey_unix.go sandbox_store.go service.go service_common.go service_linux.go store.go

Variables

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

func NetworkDeleteOptionRemoveLB Uses

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.

func SetExternalKey Uses

func SetExternalKey(shortCtlrID string, containerID string, key string, execRoot string) error

SetExternalKey provides a convenient way to set an External key to a sandbox

type ActiveContainerError Uses

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 Uses

func (ace *ActiveContainerError) Error() string

func (*ActiveContainerError) Forbidden Uses

func (ace *ActiveContainerError) Forbidden()

Forbidden denotes the type of this error

type ActiveEndpointsError Uses

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 Uses

func (aee *ActiveEndpointsError) Error() string

func (*ActiveEndpointsError) Forbidden Uses

func (aee *ActiveEndpointsError) Forbidden()

Forbidden denotes the type of this error

type ByTime Uses

type ByTime []*types.EncryptionKey

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

func (ByTime) Len Uses

func (b ByTime) Len() int

func (ByTime) Less Uses

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

func (ByTime) Swap Uses

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

type DNSBackend Uses

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(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(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(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 Uses

type Endpoint interface {
    // A system generated id for this endpoint.
    ID() string

    // Name returns the name of this endpoint.
    Name() string

    // Network returns the name of the network to which this endpoint is attached.
    Network() string

    // Join joins the sandbox to the endpoint and populates into the sandbox
    // the network resources allocated for the endpoint.
    Join(sandbox Sandbox, options ...EndpointOption) error

    // Leave detaches the network resources populated in the sandbox.
    Leave(sandbox Sandbox, options ...EndpointOption) error

    // Return certain operational data belonging to this endpoint
    Info() EndpointInfo

    // DriverInfo returns a collection of driver operational data related to this endpoint retrieved from the driver
    DriverInfo() (map[string]interface{}, error)

    // Delete and detaches this endpoint from the network.
    Delete(force bool) error
}

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

type EndpointInfo Uses

type EndpointInfo interface {
    // Iface returns InterfaceInfo, go interface that can be used
    // to get more information on the interface which was assigned to
    // the endpoint by the driver. This can be used after the
    // endpoint has been created.
    Iface() InterfaceInfo

    // 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 EndpointOption Uses

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 Uses

func CreateOptionAlias(name string, alias string) EndpointOption

CreateOptionAlias function returns an option setter for setting endpoint alias

func CreateOptionAnonymous Uses

func CreateOptionAnonymous() EndpointOption

CreateOptionAnonymous function returns an option setter for setting this endpoint as anonymous

func CreateOptionDNS Uses

func CreateOptionDNS(dns []string) EndpointOption

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

func CreateOptionDisableResolution Uses

func CreateOptionDisableResolution() EndpointOption

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

func CreateOptionExposedPorts Uses

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 Uses

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 Uses

func CreateOptionLoadBalancer() EndpointOption

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

func CreateOptionMyAlias Uses

func CreateOptionMyAlias(alias string) EndpointOption

CreateOptionMyAlias function returns an option setter for setting endpoint's self alias

func CreateOptionPortMapping Uses

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 Uses

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 Uses

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 Uses

func JoinOptionPriority(prio int) EndpointOption

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

type EndpointRecord Uses

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" json:"ingress_ports,omitempty"`
    // A list of aliases which are alternate names for the service
    Aliases []string `protobuf:"bytes,7,rep,name=aliases" json:"aliases,omitempty"`
    // List of aliases task specific aliases
    TaskAliases []string `protobuf:"bytes,8,rep,name=task_aliases,json=taskAliases" 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 Uses

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

func (*EndpointRecord) GetAliases Uses

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

func (*EndpointRecord) GetEndpointIP Uses

func (m *EndpointRecord) GetEndpointIP() string

func (*EndpointRecord) GetIngressPorts Uses

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

func (*EndpointRecord) GetName Uses

func (m *EndpointRecord) GetName() string

func (*EndpointRecord) GetServiceDisabled Uses

func (m *EndpointRecord) GetServiceDisabled() bool

func (*EndpointRecord) GetServiceID Uses

func (m *EndpointRecord) GetServiceID() string

func (*EndpointRecord) GetServiceName Uses

func (m *EndpointRecord) GetServiceName() string

func (*EndpointRecord) GetTaskAliases Uses

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

func (*EndpointRecord) GetVirtualIP Uses

func (m *EndpointRecord) GetVirtualIP() string

func (*EndpointRecord) GoString Uses

func (this *EndpointRecord) GoString() string

func (*EndpointRecord) Marshal Uses

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

func (*EndpointRecord) MarshalTo Uses

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

func (*EndpointRecord) ProtoMessage Uses

func (*EndpointRecord) ProtoMessage()

func (*EndpointRecord) Reset Uses

func (m *EndpointRecord) Reset()

func (*EndpointRecord) Size Uses

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

func (*EndpointRecord) String Uses

func (this *EndpointRecord) String() string

func (*EndpointRecord) Unmarshal Uses

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

type EndpointWalker Uses

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 ErrDataStoreNotInitialized Uses

type ErrDataStoreNotInitialized string

ErrDataStoreNotInitialized is returned if an invalid data scope is passed for getting data store

func (ErrDataStoreNotInitialized) Error Uses

func (dsni ErrDataStoreNotInitialized) Error() string

type ErrInvalidConfigFile Uses

type ErrInvalidConfigFile string

ErrInvalidConfigFile type is returned when an invalid LibNetwork config file is detected

func (ErrInvalidConfigFile) Error Uses

func (cf ErrInvalidConfigFile) Error() string

type ErrInvalidID Uses

type ErrInvalidID string

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

func (ErrInvalidID) BadRequest Uses

func (ii ErrInvalidID) BadRequest()

BadRequest denotes the type of this error

func (ErrInvalidID) Error Uses

func (ii ErrInvalidID) Error() string

type ErrInvalidJoin Uses

type ErrInvalidJoin struct{}

ErrInvalidJoin is returned if a join is attempted on an endpoint which already has a container joined.

func (ErrInvalidJoin) BadRequest Uses

func (ij ErrInvalidJoin) BadRequest()

BadRequest denotes the type of this error

func (ErrInvalidJoin) Error Uses

func (ij ErrInvalidJoin) Error() string

type ErrInvalidName Uses

type ErrInvalidName string

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

func (ErrInvalidName) BadRequest Uses

func (in ErrInvalidName) BadRequest()

BadRequest denotes the type of this error

func (ErrInvalidName) Error Uses

func (in ErrInvalidName) Error() string

type ErrInvalidNetworkDriver Uses

type ErrInvalidNetworkDriver string

ErrInvalidNetworkDriver is returned if an invalid driver name is passed.

func (ErrInvalidNetworkDriver) BadRequest Uses

func (ind ErrInvalidNetworkDriver) BadRequest()

BadRequest denotes the type of this error

func (ErrInvalidNetworkDriver) Error Uses

func (ind ErrInvalidNetworkDriver) Error() string

type ErrNoContainer Uses

type ErrNoContainer struct{}

ErrNoContainer is returned when the endpoint has no container attached to it.

func (ErrNoContainer) Error Uses

func (nc ErrNoContainer) Error() string

func (ErrNoContainer) Maskable Uses

func (nc ErrNoContainer) Maskable()

Maskable denotes the type of this error

type ErrNoSuchEndpoint Uses

type ErrNoSuchEndpoint string

ErrNoSuchEndpoint is returned when an endpoint query finds no result

func (ErrNoSuchEndpoint) Error Uses

func (nse ErrNoSuchEndpoint) Error() string

func (ErrNoSuchEndpoint) NotFound Uses

func (nse ErrNoSuchEndpoint) NotFound()

NotFound denotes the type of this error

type ErrNoSuchNetwork Uses

type ErrNoSuchNetwork string

ErrNoSuchNetwork is returned when a network query finds no result

func (ErrNoSuchNetwork) Error Uses

func (nsn ErrNoSuchNetwork) Error() string

func (ErrNoSuchNetwork) NotFound Uses

func (nsn ErrNoSuchNetwork) NotFound()

NotFound denotes the type of this error

type InterfaceInfo Uses

type InterfaceInfo interface {
    // MacAddress returns the MAC address assigned to the endpoint.
    MacAddress() net.HardwareAddr

    // Address returns the IPv4 address assigned to the endpoint.
    Address() *net.IPNet

    // AddressIPv6 returns the IPv6 address assigned to the endpoint.
    AddressIPv6() *net.IPNet

    // LinkLocalAddresses returns the list of link-local (IPv4/IPv6) addresses assigned to the endpoint.
    LinkLocalAddresses() []*net.IPNet

    // SrcName returns the name of the interface w/in the container
    SrcName() string
}

InterfaceInfo provides an interface to retrieve interface addresses bound to the endpoint.

type InvalidContainerIDError Uses

type InvalidContainerIDError string

InvalidContainerIDError is returned when an invalid container id is passed in Join/Leave

func (InvalidContainerIDError) BadRequest Uses

func (id InvalidContainerIDError) BadRequest()

BadRequest denotes the type of this error

func (InvalidContainerIDError) Error Uses

func (id InvalidContainerIDError) Error() string

type IpamConf Uses

type IpamConf struct {
    // The master address pool for containers and network interfaces
    PreferredPool string
    // A subset of the master pool. If specified,
    // this becomes the container pool
    SubPool string
    // Preferred Network Gateway address (optional)
    Gateway string
    // 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

func (*IpamConf) CopyTo Uses

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

CopyTo deep copies to the destination IpamConfig

func (*IpamConf) Validate Uses

func (c *IpamConf) Validate() error

Validate checks whether the configuration is valid

type IpamInfo Uses

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 Uses

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

CopyTo deep copies to the destination IpamInfo

func (*IpamInfo) MarshalJSON Uses

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

MarshalJSON encodes IpamInfo into json message

func (*IpamInfo) UnmarshalJSON Uses

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

UnmarshalJSON decodes json message into PoolData

type ManagerRedirectError Uses

type ManagerRedirectError string

ManagerRedirectError is returned when the request should be redirected to Manager

func (ManagerRedirectError) Error Uses

func (mr ManagerRedirectError) Error() string

func (ManagerRedirectError) Maskable Uses

func (mr ManagerRedirectError) Maskable()

Maskable denotes the type of this error

type Network Uses

type Network interface {
    // A user chosen name for this network.
    Name() string

    // A system generated id for this network.
    ID() string

    // The type of network, which corresponds to its managing driver.
    Type() string

    // Create a new endpoint to this network symbolically identified by the
    // specified unique name. The options parameter carries driver specific options.
    CreateEndpoint(name string, options ...EndpointOption) (Endpoint, error)

    // Delete the network.
    Delete(options ...NetworkDeleteOption) error

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

    // WalkEndpoints uses the provided function to walk the Endpoints
    WalkEndpoints(walker EndpointWalker)

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

    // EndpointByID returns the Endpoint which has the passed id. If not found, the error ErrNoSuchEndpoint is returned.
    EndpointByID(id string) (Endpoint, error)

    // Return certain operational data belonging to this network
    Info() NetworkInfo
}

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

type NetworkController Uses

type NetworkController interface {
    // ID provides a unique identity for the controller
    ID() string

    // BuiltinDrivers returns list of builtin drivers
    BuiltinDrivers() []string

    // BuiltinIPAMDrivers returns list of builtin ipam drivers
    BuiltinIPAMDrivers() []string

    // Config method returns the bootup configuration for the controller
    Config() config.Config

    // Create a new network. The options parameter carries network specific options.
    NewNetwork(networkType, name string, id string, options ...NetworkOption) (Network, error)

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

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

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

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

    // NewSandbox creates a new network sandbox for the passed container id
    NewSandbox(containerID string, options ...SandboxOption) (Sandbox, error)

    // Sandboxes returns the list of Sandbox(s) managed by this controller.
    Sandboxes() []Sandbox

    // WalkSandboxes uses the provided function to walk the Sandbox(s) managed by this controller.
    WalkSandboxes(walker SandboxWalker)

    // SandboxByID returns the Sandbox which has the passed id. If not found, a types.NotFoundError is returned.
    SandboxByID(id string) (Sandbox, error)

    // SandboxDestroy destroys a sandbox given a container ID
    SandboxDestroy(id string) error

    // Stop network controller
    Stop()

    // ReloadConfiguration updates the controller configuration
    ReloadConfiguration(cfgOptions ...config.Option) error

    // SetClusterProvider sets cluster provider
    SetClusterProvider(provider cluster.Provider)

    // Wait for agent initialization complete in libnetwork controller
    AgentInitWait()

    // Wait for agent to stop if running
    AgentStopWait()

    // SetKeys configures the encryption key for gossip and overlay data path
    SetKeys(keys []*types.EncryptionKey) error

    // StartDiagnostic start the network diagnostic mode
    StartDiagnostic(port int)
    // StopDiagnostic start the network diagnostic mode
    StopDiagnostic()
    // IsDiagnosticEnabled returns true if the diagnostic is enabled
    IsDiagnosticEnabled() bool
}

NetworkController provides the interface for controller instance which manages networks.

func New Uses

func New(cfgOptions ...config.Option) (NetworkController, error)

New creates a new instance of network controller.

type NetworkDeleteOption Uses

type NetworkDeleteOption func(p *networkDeleteParams)

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

type NetworkInfo Uses

type NetworkInfo interface {
    IpamConfig() (string, map[string]string, []*IpamConf, []*IpamConf)
    IpamInfo() ([]*IpamInfo, []*IpamInfo)
    DriverOptions() map[string]string
    Scope() string
    IPv6Enabled() bool
    Internal() bool
    Attachable() bool
    Ingress() bool
    ConfigFrom() string
    ConfigOnly() bool
    Labels() map[string]string
    Dynamic() bool
    Created() time.Time
    // 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
    Peers() []networkdb.PeerInfo
    //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.
    Services() map[string]ServiceInfo
}

NetworkInfo returns some configuration and operational information about the network

type NetworkNameError Uses

type NetworkNameError string

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

func (NetworkNameError) Error Uses

func (nnr NetworkNameError) Error() string

func (NetworkNameError) Forbidden Uses

func (nnr NetworkNameError) Forbidden()

Forbidden denotes the type of this error

type NetworkOption Uses

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 Uses

func NetworkOptionAttachable(attachable bool) NetworkOption

NetworkOptionAttachable returns an option setter to set attachable for a network

func NetworkOptionConfigFrom Uses

func NetworkOptionConfigFrom(name string) NetworkOption

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

func NetworkOptionConfigOnly Uses

func NetworkOptionConfigOnly() NetworkOption

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

func NetworkOptionDeferIPv6Alloc Uses

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 Uses

func NetworkOptionDriverOpts(opts map[string]string) NetworkOption

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

func NetworkOptionDynamic Uses

func NetworkOptionDynamic() NetworkOption

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

func NetworkOptionEnableIPv6 Uses

func NetworkOptionEnableIPv6(enableIPv6 bool) NetworkOption

NetworkOptionEnableIPv6 returns an option setter to explicitly configure IPv6

func NetworkOptionGeneric Uses

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 Uses

func NetworkOptionIngress(ingress bool) NetworkOption

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

func NetworkOptionInternalNetwork Uses

func NetworkOptionInternalNetwork() NetworkOption

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

func NetworkOptionIpam Uses

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 Uses

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 Uses

func NetworkOptionLabels(labels map[string]string) NetworkOption

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

func NetworkOptionPersist Uses

func NetworkOptionPersist(persist bool) NetworkOption

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

func NetworkOptionScope Uses

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 NetworkTypeError Uses

type NetworkTypeError string

NetworkTypeError type is returned when the network type string is not known to libnetwork.

func (NetworkTypeError) Error Uses

func (nt NetworkTypeError) Error() string

func (NetworkTypeError) NotFound Uses

func (nt NetworkTypeError) NotFound()

NotFound denotes the type of this error

type NetworkWalker Uses

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 Uses

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 Uses

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

func (*PortConfig) GetName Uses

func (m *PortConfig) GetName() string

func (*PortConfig) GetProtocol Uses

func (m *PortConfig) GetProtocol() PortConfig_Protocol

func (*PortConfig) GetPublishedPort Uses

func (m *PortConfig) GetPublishedPort() uint32

func (*PortConfig) GetTargetPort Uses

func (m *PortConfig) GetTargetPort() uint32

func (*PortConfig) GoString Uses

func (this *PortConfig) GoString() string

func (*PortConfig) Marshal Uses

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

func (*PortConfig) MarshalTo Uses

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

func (*PortConfig) ProtoMessage Uses

func (*PortConfig) ProtoMessage()

func (*PortConfig) Reset Uses

func (m *PortConfig) Reset()

func (*PortConfig) Size Uses

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

func (*PortConfig) String Uses

func (this *PortConfig) String() string

func (*PortConfig) Unmarshal Uses

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

type PortConfig_Protocol Uses

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

func (PortConfig_Protocol) EnumDescriptor Uses

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

func (PortConfig_Protocol) String Uses

func (x PortConfig_Protocol) String() string

type Resolver Uses

type Resolver interface {
    // Start starts the name server for the container
    Start() error
    // Stop stops the name server for the container. Stopped resolver
    // can be reused after running the SetupFunc again.
    Stop()
    // SetupFunc() provides the setup function that should be run
    // in the container's network namespace.
    SetupFunc(int) func()
    // NameServer() returns the IP of the DNS resolver for the
    // containers.
    NameServer() string
    // SetExtServers configures the external nameservers the resolver
    // should use to forward queries
    SetExtServers([]extDNSEntry)
    // ResolverOptions returns resolv.conf options that should be set
    ResolverOptions() []string
}

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

func NewResolver Uses

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

NewResolver creates a new instance of the Resolver

type Sandbox Uses

type Sandbox interface {
    // ID returns the ID of the sandbox
    ID() string
    // Key returns the sandbox's key
    Key() string
    // ContainerID returns the container id associated to this sandbox
    ContainerID() string
    // Labels returns the sandbox's labels
    Labels() map[string]interface{}
    // Statistics retrieves the interfaces' statistics for the sandbox
    Statistics() (map[string]*types.InterfaceStatistics, error)
    // Refresh leaves all the endpoints, resets and re-applies the options,
    // re-joins all the endpoints without destroying the osl sandbox
    Refresh(options ...SandboxOption) error
    // SetKey updates the Sandbox Key
    SetKey(key string) error
    // Rename changes the name of all attached Endpoints
    Rename(name string) error
    // Delete destroys this container after detaching it from all connected endpoints.
    Delete() error
    // Endpoints returns all the endpoints connected to the sandbox
    Endpoints() []Endpoint
    // ResolveService returns all the backend details about the containers or hosts
    // backing a service. Its purpose is to satisfy an SRV query
    ResolveService(name string) ([]*net.SRV, []net.IP)
    // EnableService  makes a managed container's service available by adding the
    // endpoint to the service load balancer and service discovery
    EnableService() error
    // DisableService removes a managed container's endpoints from the load balancer
    // and service discovery
    DisableService() error
}

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

type SandboxOption Uses

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 Uses

func OptionDNS(dns string) SandboxOption

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

func OptionDNSOptions Uses

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 Uses

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 Uses

func OptionDomainname(name string) SandboxOption

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

func OptionExposedPorts Uses

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 Uses

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 Uses

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 Uses

func OptionHostname(name string) SandboxOption

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

func OptionHostsPath Uses

func OptionHostsPath(path string) SandboxOption

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

func OptionIngress Uses

func OptionIngress() SandboxOption

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

func OptionLoadBalancer Uses

func OptionLoadBalancer(nid string) SandboxOption

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

func OptionOriginHostsPath Uses

func OptionOriginHostsPath(path string) SandboxOption

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

func OptionOriginResolvConfPath Uses

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 Uses

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 Uses

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 Uses

func OptionResolvConfPath(path string) SandboxOption

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

func OptionUseDefaultSandbox Uses

func OptionUseDefaultSandbox() SandboxOption

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

func OptionUseExternalKey Uses

func OptionUseExternalKey() SandboxOption

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

type SandboxWalker Uses

type SandboxWalker func(sb Sandbox) bool

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

func SandboxContainerWalker Uses

func SandboxContainerWalker(out *Sandbox, containerID string) SandboxWalker

SandboxContainerWalker returns a Sandbox Walker function which looks for an existing Sandbox with the passed containerID

func SandboxKeyWalker Uses

func SandboxKeyWalker(out *Sandbox, key string) SandboxWalker

SandboxKeyWalker returns a Sandbox Walker function which looks for an existing Sandbox with the passed key

type ServiceInfo Uses

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 Uses

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

Task has the backend container details

type UnknownEndpointError Uses

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

UnknownEndpointError is returned when libnetwork could not find in its database an endpoint with the same name and id.

func (*UnknownEndpointError) Error Uses

func (uee *UnknownEndpointError) Error() string

func (*UnknownEndpointError) NotFound Uses

func (uee *UnknownEndpointError) NotFound()

NotFound denotes the type of this error

type UnknownNetworkError Uses

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 Uses

func (une *UnknownNetworkError) Error() string

func (*UnknownNetworkError) NotFound Uses

func (une *UnknownNetworkError) NotFound()

NotFound denotes the type of this error

Directories

PathSynopsis
bitseqPackage bitseq provides a structure and utilities for representing long bitmask as sequence of run-length encoded blocks.
cluster
config
datastore
diagnostic
discoverapi
driverapi
drvregistry
etchosts
hostdiscovery
idmPackage idm manages reservation/release of numerical ids from a configured set of contiguous ids
ipam
ipamapiPackage ipamapi specifies the contract the IPAM service (built-in or remote) needs to satisfy.
ipamutilsPackage ipamutils provides utility functions for ipam management
iptables
netlabel
netutils
networkdbPackage networkdb is a generated protocol buffer package.
ns
optionsPackage options provides a way to pass unstructured sets of options to a component expecting a strongly-typed configuration structure.
oslPackage osl describes structures and interfaces which abstract os entities
osl/kernel
portallocator
portmapper
resolvconfPackage resolvconf provides utility code to query and update DNS configuration in /etc/resolv.conf
resolvconf/dns
typesPackage types contains types that are common across libnetwork project

Package libnetwork imports 73 packages (graph). Updated 2020-12-24. Refresh now. Tools for package owners.