libnetwork
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package libnetwork provides the basic functionality and extension points tocreate network namespaces and allocate interfaces for containers to use.
networkType := "bridge"// Create a new controller instancedriverOptions := options.Generic{}genericOption := make(map[string]interface{})genericOption[netlabel.GenericData] = driverOptionscontroller, 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 ofnetwork, 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¶
- Variables
- func NetworkDeleteOptionRemoveLB(p *networkDeleteParams)
- type ActiveContainerError
- type ActiveEndpointsError
- type ByNetworkType
- type ByTime
- type Controller
- func (c *Controller) AgentInitWait()
- func (c *Controller) AgentStopWait()
- func (c *Controller) BuiltinDrivers() []string
- func (c *Controller) BuiltinIPAMDrivers() []string
- func (c *Controller) Config() config.Config
- func (c *Controller) FirewallBackend() *system.FirewallInfo
- func (c *Controller) GetPluginGetter() plugingetter.PluginGetter
- func (c *Controller) GetSandbox(containerID string) (*Sandbox, error)
- func (c *Controller) ID() string
- func (c *Controller) IsDiagnosticEnabled() bool
- func (c *Controller) NetworkByID(id string) (*Network, error)
- func (c *Controller) NetworkByName(name string) (*Network, error)
- func (c *Controller) Networks(ctx context.Context) []*Network
- func (c *Controller) NewNetwork(ctx context.Context, networkType, name string, id string, ...) (_ *Network, retErr error)
- func (c *Controller) NewSandbox(ctx context.Context, containerID string, options ...SandboxOption) (_ *Sandbox, retErr error)
- func (c *Controller) RegisterDriver(_ string, driver driverapi.Driver, _ driverapi.Capability) error
- func (c *Controller) RegisterNetworkAllocator(_ string, _ driverapi.NetworkAllocator) error
- func (c *Controller) SandboxByID(id string) (*Sandbox, error)
- func (c *Controller) SandboxDestroy(ctx context.Context, id string) error
- func (c *Controller) SetClusterProvider(provider cluster.Provider)
- func (c *Controller) SetKeys(keys []*types.EncryptionKey) error
- func (c *Controller) StartDiagnostic(port int)
- func (c *Controller) Stop()
- func (c *Controller) StopDiagnostic()
- func (c *Controller) WalkNetworks(walker NetworkWalker)
- type DNSBackend
- type Endpoint
- func (ep *Endpoint) AddStaticRoute(destination *net.IPNet, routeType types.RouteType, nextHop net.IP) error
- func (ep *Endpoint) AddTableEntry(tableName, key string, value []byte) error
- func (ep *Endpoint) CopyTo(o datastore.KVObject) error
- func (ep *Endpoint) Delete(ctx context.Context, force bool) error
- func (ep *Endpoint) DisableGatewayService()
- func (ep *Endpoint) DriverInfo() (map[string]any, error)
- func (ep *Endpoint) Exists() bool
- func (ep *Endpoint) ForceGw4()
- func (ep *Endpoint) ForceGw6()
- func (ep *Endpoint) Gateway() net.IP
- func (ep *Endpoint) GatewayIPv6() net.IP
- func (ep *Endpoint) ID() string
- func (ep *Endpoint) Iface() *EndpointInterface
- func (ep *Endpoint) Index() uint64
- func (ep *Endpoint) Info() EndpointInfo
- func (ep *Endpoint) InterfaceName() driverapi.InterfaceNameInfo
- func (ep *Endpoint) Join(ctx context.Context, sb *Sandbox, options ...EndpointOption) error
- func (ep *Endpoint) Key() []string
- func (ep *Endpoint) KeyPrefix() []string
- func (ep *Endpoint) Leave(ctx context.Context, sb *Sandbox) error
- func (ep *Endpoint) Less(epj *Endpoint) bool
- func (ep *Endpoint) LoadBalancer() bool
- func (ep *Endpoint) MarshalJSON() ([]byte, error)
- func (ep *Endpoint) Name() string
- func (ep *Endpoint) Network() string
- func (ep *Endpoint) New() datastore.KVObject
- func (ep *Endpoint) Sandbox() *Sandbox
- func (ep *Endpoint) SetGateway(gw net.IP) error
- func (ep *Endpoint) SetGatewayIPv6(gw6 net.IP) error
- func (ep *Endpoint) SetIndex(index uint64)
- func (ep *Endpoint) SetValue(value []byte) error
- func (ep *Endpoint) Skip() bool
- func (ep *Endpoint) StaticRoutes() []*types.StaticRoute
- func (ep *Endpoint) UnmarshalJSON(b []byte) (err error)
- func (ep *Endpoint) UpdateDNSNames(dnsNames []string) error
- func (ep *Endpoint) Value() []byte
- type EndpointInfo
- type EndpointInterface
- func (epi *EndpointInterface) Addr() netip.Prefix
- func (epi *EndpointInterface) AddrIPv6() netip.Prefix
- func (epi *EndpointInterface) Address() *net.IPNet
- func (epi *EndpointInterface) AddressIPv6() *net.IPNet
- func (epi *EndpointInterface) Copy() *EndpointInterface
- func (epi *EndpointInterface) LinkLocalAddresses() []*net.IPNet
- func (epi *EndpointInterface) MacAddress() net.HardwareAddr
- func (epi *EndpointInterface) MarshalJSON() ([]byte, error)
- func (epi *EndpointInterface) NetnsPath() string
- func (epi *EndpointInterface) SetCreatedInContainer(cic bool)
- func (epi *EndpointInterface) SetIPAddress(address *net.IPNet) error
- func (epi *EndpointInterface) SetMacAddress(mac net.HardwareAddr) error
- func (epi *EndpointInterface) SetNames(srcName, dstPrefix, dstName string) error
- func (epi *EndpointInterface) SrcName() string
- func (epi *EndpointInterface) UnmarshalJSON(b []byte) error
- type EndpointOption
- func CreateOptionAlias(name string, alias string) EndpointOption
- func CreateOptionDNS(dns []string) EndpointOption
- func CreateOptionDNSNames(names []string) EndpointOption
- func CreateOptionDisableIPv6() EndpointOption
- func CreateOptionDisableResolution() EndpointOption
- func CreateOptionExposedPorts(exposedPorts []types.TransportPort) EndpointOption
- func CreateOptionIPAM(ipV4, ipV6 net.IP, llIPs []net.IP) EndpointOption
- func CreateOptionLoadBalancer() EndpointOption
- func CreateOptionPortMapping(portBindings []types.PortBinding) EndpointOption
- func CreateOptionService(name, id string, vip net.IP, ingressPorts []*PortConfig, aliases []string) EndpointOption
- func EndpointOptionGeneric(generic map[string]any) EndpointOption
- func JoinOptionPriority(prio int) EndpointOption
- func WithNetnsPath(path string) EndpointOption
- type EndpointRecord
- func (*EndpointRecord) Descriptor() ([]byte, []int)
- func (m *EndpointRecord) GetAliases() []string
- func (m *EndpointRecord) GetEndpointIP() string
- func (m *EndpointRecord) GetIngressPorts() []*PortConfig
- func (m *EndpointRecord) GetName() string
- func (m *EndpointRecord) GetServiceDisabled() bool
- func (m *EndpointRecord) GetServiceID() string
- func (m *EndpointRecord) GetServiceName() string
- func (m *EndpointRecord) GetTaskAliases() []string
- func (m *EndpointRecord) GetVirtualIP() string
- func (this *EndpointRecord) GoString() string
- func (m *EndpointRecord) Marshal() (dAtA []byte, err error)
- func (m *EndpointRecord) MarshalTo(dAtA []byte) (int, error)
- func (m *EndpointRecord) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*EndpointRecord) ProtoMessage()
- func (m *EndpointRecord) Reset()
- func (m *EndpointRecord) Size() (n int)
- func (this *EndpointRecord) String() string
- func (m *EndpointRecord) Unmarshal(dAtA []byte) error
- func (m *EndpointRecord) XXX_DiscardUnknown()
- func (m *EndpointRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *EndpointRecord) XXX_Merge(src proto.Message)
- func (m *EndpointRecord) XXX_Size() int
- func (m *EndpointRecord) XXX_Unmarshal(b []byte) error
- type EndpointWalker
- type ErrNoSuchNetwork
- type IpamConf
- type IpamInfo
- type ManagerRedirectError
- type Network
- func (n *Network) Attachable() bool
- func (n *Network) ConfigFrom() string
- func (n *Network) ConfigOnly() bool
- func (n *Network) CopyTo(o datastore.KVObject) error
- func (n *Network) CreateEndpoint(ctx context.Context, name string, options ...EndpointOption) (*Endpoint, error)
- func (n *Network) Created() time.Time
- func (n *Network) Delete(options ...NetworkDeleteOption) error
- func (n *Network) Driver() string
- func (n *Network) DriverOptions() map[string]string
- func (n *Network) Dynamic() bool
- func (n *Network) EndpointByName(name string) (*Endpoint, error)
- func (n *Network) Endpoints() []*Endpoint
- func (n *Network) Exists() bool
- func (n *Network) HandleQueryResp(name string, ip net.IP)
- func (n *Network) HasContainerAttachments() bool
- func (n *Network) HasServiceAttachments() bool
- func (n *Network) ID() string
- func (n *Network) IPAMStatus(ctx context.Context) (network.IPAMStatus, error)
- func (n *Network) IPv4Enabled() bool
- func (n *Network) IPv6Enabled() bool
- func (n *Network) Index() uint64
- func (n *Network) Ingress() bool
- func (n *Network) Internal() bool
- func (n *Network) IpamConfig() (ipamType string, ipamOptions map[string]string, ipamV4Config []*IpamConf, ...)
- func (n *Network) IpamInfo() (ipamV4Info []*IpamInfo, ipamV6Info []*IpamInfo)
- func (n *Network) IsPruneable() bool
- func (n *Network) Key() []string
- func (n *Network) KeyPrefix() []string
- func (n *Network) Labels() map[string]string
- func (n *Network) MarshalJSON() ([]byte, error)
- func (n *Network) Name() string
- func (n *Network) NdotsSet() bool
- func (n *Network) New() datastore.KVObject
- func (n *Network) Peers() []networkdb.PeerInfo
- func (n *Network) ResolveIP(_ context.Context, ip string) string
- func (n *Network) ResolveName(ctx context.Context, req string, ipType types.IPFamily) ([]net.IP, bool)
- func (n *Network) ResolveService(ctx context.Context, name string) ([]*net.SRV, []net.IP)
- func (n *Network) Resolvers() []*Resolver
- func (n *Network) Scope() string
- func (n *Network) Services() map[string]ServiceInfo
- func (n *Network) SetIndex(index uint64)
- func (n *Network) SetValue(value []byte) error
- func (n *Network) Skip() bool
- func (n *Network) TableEventRegister(tableName string, objType driverapi.ObjectType) error
- func (n *Network) Type() string
- func (n *Network) UnmarshalJSON(b []byte) (err error)
- func (n *Network) UpdateIpamConfig(ipV4Data []driverapi.IPAMData)
- func (n *Network) Value() []byte
- func (n *Network) WalkEndpoints(walker EndpointWalker)
- type NetworkDeleteOption
- type NetworkNameError
- type NetworkOption
- func NetworkOptionAttachable(attachable bool) NetworkOption
- func NetworkOptionConfigFrom(name string) NetworkOption
- func NetworkOptionConfigOnly() NetworkOption
- func NetworkOptionDriverOpts(opts map[string]string) NetworkOption
- func NetworkOptionDynamic() NetworkOption
- func NetworkOptionEnableIPv4(enableIPv4 bool) NetworkOption
- func NetworkOptionEnableIPv6(enableIPv6 bool) NetworkOption
- func NetworkOptionGeneric(generic map[string]any) NetworkOption
- func NetworkOptionIngress(ingress bool) NetworkOption
- func NetworkOptionInternalNetwork() NetworkOption
- func NetworkOptionIpam(ipamDriver string, addrSpace string, ipV4 []*IpamConf, ipV6 []*IpamConf, ...) NetworkOption
- func NetworkOptionLBEndpoint(ip net.IP) NetworkOption
- func NetworkOptionLabels(labels map[string]string) NetworkOption
- func NetworkOptionPersist(persist bool) NetworkOption
- func NetworkOptionScope(scope string) NetworkOption
- type NetworkWalker
- type PortConfig
- func (*PortConfig) Descriptor() ([]byte, []int)
- func (m *PortConfig) GetName() string
- func (m *PortConfig) GetProtocol() PortConfig_Protocol
- func (m *PortConfig) GetPublishedPort() uint32
- func (m *PortConfig) GetTargetPort() uint32
- func (this *PortConfig) GoString() string
- func (m *PortConfig) Marshal() (dAtA []byte, err error)
- func (m *PortConfig) MarshalTo(dAtA []byte) (int, error)
- func (m *PortConfig) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PortConfig) ProtoMessage()
- func (m *PortConfig) Reset()
- func (m *PortConfig) Size() (n int)
- func (this *PortConfig) String() string
- func (m *PortConfig) Unmarshal(dAtA []byte) error
- func (m *PortConfig) XXX_DiscardUnknown()
- func (m *PortConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PortConfig) XXX_Merge(src proto.Message)
- func (m *PortConfig) XXX_Size() int
- func (m *PortConfig) XXX_Unmarshal(b []byte) error
- type PortConfig_Protocol
- type Resolver
- func (r *Resolver) NameServer() netip.Addr
- func (r *Resolver) ResolverOptions() []string
- func (r *Resolver) SetExtServers(extDNS []extDNSEntry)
- func (r *Resolver) SetExtServersForSrc(srcAddr netip.Addr, extDNS []extDNSEntry) error
- func (r *Resolver) SetForwardingPolicy(policy bool)
- func (r *Resolver) SetupFunc(port uint16) func()
- func (r *Resolver) Start() error
- func (r *Resolver) Stop()
- type Sandbox
- func (sb *Sandbox) AddHostsEntry(ctx context.Context, name string, ip netip.Addr) error
- func (sb *Sandbox) ContainerID() string
- func (sb *Sandbox) Delete(ctx context.Context) error
- func (sb *Sandbox) DisableService() error
- func (sb *Sandbox) EnableService() (retErr error)
- func (sb *Sandbox) Endpoints() []*Endpoint
- func (sb *Sandbox) ExecFunc(f func()) error
- func (sb *Sandbox) GetEndpoint(id string) *Endpoint
- func (sb *Sandbox) HandleQueryResp(name string, ip net.IP)
- func (sb *Sandbox) ID() string
- func (sb *Sandbox) IPv6Enabled() (enabled, ok bool)
- func (sb *Sandbox) Key() string
- func (sb *Sandbox) Labels() map[string]any
- func (sb *Sandbox) MarshalJSON() ([]byte, error)
- func (sb *Sandbox) NdotsSet() bool
- func (sb *Sandbox) NetnsPath() (path string, ok bool)
- func (sb *Sandbox) Refresh(ctx context.Context, options ...SandboxOption) error
- func (sb *Sandbox) Rename(name string) error
- func (sb *Sandbox) ResolveIP(ctx context.Context, ip string) string
- func (sb *Sandbox) ResolveName(ctx context.Context, name string, ipType types.IPFamily) ([]net.IP, bool)
- func (sb *Sandbox) ResolveService(ctx context.Context, name string) ([]*net.SRV, []net.IP)
- func (sb *Sandbox) SetKey(ctx context.Context, basePath string) error
- func (sb *Sandbox) Statistics() (map[string]*types.InterfaceStatistics, error)
- func (sb *Sandbox) UnmarshalJSON(b []byte) (err error)
- func (sb *Sandbox) UpdateHostsEntry(regexp string, ip netip.Addr) error
- func (sb *Sandbox) UpdateLabels(labels map[string]any)
- type SandboxOption
- func OptionDNS(dns []netip.Addr) SandboxOption
- func OptionDNSOptions(options []string) SandboxOption
- func OptionDNSSearch(search []string) SandboxOption
- func OptionDomainname(name string) SandboxOption
- func OptionExposedPorts(exposedPorts []types.TransportPort) SandboxOption
- func OptionExtraHost(name string, IP netip.Addr) SandboxOption
- func OptionHostname(name string) SandboxOption
- func OptionHostsPath(path string) SandboxOption
- func OptionIngress() SandboxOption
- func OptionLoadBalancer(nid string) SandboxOption
- func OptionOriginHostsPath(path string) SandboxOption
- func OptionOriginResolvConfPath(path string) SandboxOption
- func OptionPortMapping(portBindings []types.PortBinding) SandboxOption
- func OptionResolvConfPath(path string) SandboxOption
- func OptionUseDefaultSandbox() SandboxOption
- func OptionUseExternalKey() SandboxOption
- type ServiceInfo
- type Task
Constants¶
This section is empty.
Variables¶
var (ErrInvalidLengthAgent =fmt.Errorf("proto: negative length found during unmarshaling")ErrIntOverflowAgent =fmt.Errorf("proto: integer overflow")ErrUnexpectedEndOfGroupAgent =fmt.Errorf("proto: unexpected end of group"))
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,}Functions¶
funcNetworkDeleteOptionRemoveLB¶
func NetworkDeleteOptionRemoveLB(p *networkDeleteParams)
NetworkDeleteOptionRemoveLB informs a Network.Delete() operation that shouldremove the load balancer endpoint for this network. Note that the Delete()method will automatically remove a load balancing endpoint for most networkswhen the network is otherwise empty. However, this does not occur for somenetworks. In particular, networks marked as ingress (which are supposed tobe more permanent than other overlay networks) won't automatically removethe LB endpoint on Delete(). This method allows for explicit removal ofsuch networks provided there are no other endpoints present in the network.If the network still has non-LB endpoints present, Delete() will notremove the LB endpoint and will return an error.
Types¶
typeActiveContainerError¶
type ActiveContainerError struct {// contains filtered or unexported fields}ActiveContainerError is returned when an endpoint is deleted which has activecontainers 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
typeActiveEndpointsError¶
type ActiveEndpointsError struct {// contains filtered or unexported fields}ActiveEndpointsError is returned when a network is deleted which has activeendpoints in it.
func (*ActiveEndpointsError)Error¶
func (aee *ActiveEndpointsError) Error()string
func (*ActiveEndpointsError)Forbidden¶
func (aee *ActiveEndpointsError) Forbidden()
Forbidden denotes the type of this error
typeByNetworkType¶
type ByNetworkType []*Endpoint
ByNetworkType sorts aEndpoint slice based on the network-typethey're attached to. It implementssort.Interface and can be usedwithsort.Stable orsort.Sort. It is used bySandbox.ResolveNamewhen resolving names in swarm mode. In swarm mode, services with exposedports are connected to user overlay network, ingress network, and local("docker_gwbridge") networks. Name resolution should prioritize returningthe VIP/IPs on user overlay network over ingress and local networks.
ByNetworkType re-orders the endpoints based on the network-type theyare attached to:
- dynamic networks (user overlay networks)
- ingress network(s)
- local networks ("docker_gwbridge")
func (ByNetworkType)Len¶
func (epByNetworkType) Len()int
func (ByNetworkType)Less¶
func (epByNetworkType) Less(i, jint)bool
func (ByNetworkType)Swap¶
func (epByNetworkType) Swap(i, jint)
typeByTime¶
type ByTime []*types.EncryptionKey
ByTime implements sort.Interface for []*types.EncryptionKey based onthe LamportTime field.
typeController¶
type Controller struct {// contains filtered or unexported fields}Controller manages networks.
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)FirewallBackend¶
func (c *Controller) FirewallBackend() *system.FirewallInfo
FirewallBackend returns the name of the firewall backend for "docker info".
func (*Controller)GetPluginGetter¶
func (c *Controller) GetPluginGetter()plugingetter.PluginGetter
func (*Controller)GetSandbox¶
func (c *Controller) GetSandbox(containerIDstring) (*Sandbox,error)
GetSandbox returns the Sandbox which has the passed id.
It returns an [ErrInvalidID] when passing an invalid ID, or anerrdefs.ErrNotFound if no Sandbox was found for the container.
func (*Controller)IsDiagnosticEnabled¶
func (c *Controller) IsDiagnosticEnabled()bool
IsDiagnosticEnabled returns true if the diagnostic server is running.
func (*Controller)NetworkByID¶
func (c *Controller) NetworkByID(idstring) (*Network,error)
NetworkByID returns the Network which has the passed id.If not found, the errorErrNoSuchNetwork is returned.
func (*Controller)NetworkByName¶
func (c *Controller) NetworkByName(namestring) (*Network,error)
NetworkByName returns the Network which has the passed name.If not found, the errorErrNoSuchNetwork is returned.
func (*Controller)Networks¶
func (c *Controller) Networks(ctxcontext.Context) []*Network
Networks returns the list of Network(s) managed by this controller.
func (*Controller)NewNetwork¶
func (c *Controller) NewNetwork(ctxcontext.Context, networkType, namestring, idstring, options ...NetworkOption) (_ *Network, retErrerror)
NewNetwork creates a new network of the specified network type. The optionsare network specific and modeled in a generic way.
func (*Controller)NewSandbox¶
func (c *Controller) NewSandbox(ctxcontext.Context, containerIDstring, options ...SandboxOption) (_ *Sandbox, retErrerror)
NewSandbox creates a new sandbox for containerID.
func (*Controller)RegisterDriver¶
func (c *Controller) RegisterDriver(_string, driverdriverapi.Driver, _driverapi.Capability)error
func (*Controller)RegisterNetworkAllocator¶
func (c *Controller) RegisterNetworkAllocator(_string, _driverapi.NetworkAllocator)error
func (*Controller)SandboxByID¶
func (c *Controller) SandboxByID(idstring) (*Sandbox,error)
SandboxByID returns the Sandbox which has the passed id.If not found, aerrdefs.NotFoundError is returned.
func (*Controller)SandboxDestroy¶
func (c *Controller) SandboxDestroy(ctxcontext.Context, idstring)error
SandboxDestroy destroys a sandbox given a container ID.
func (*Controller)SetClusterProvider¶
func (c *Controller) SetClusterProvider(providercluster.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(portint)
StartDiagnostic starts the network diagnostic server listening on port.
func (*Controller)StopDiagnostic¶
func (c *Controller) StopDiagnostic()
StopDiagnostic stops the network diagnostic server.
func (*Controller)WalkNetworks¶
func (c *Controller) WalkNetworks(walkerNetworkWalker)
WalkNetworks uses the provided function to walk the Network(s) managed by this controller.
typeDNSBackend¶
type DNSBackend interface {// ResolveName resolves a service name to an IPv4 or IPv6 address by searching// the networks the sandbox is connected to. The second return value will be// true if the name exists in docker domain, even if there are no addresses of// the required type. Such queries shouldn't be forwarded to external nameservers.ResolveName(ctxcontext.Context, namestring, ipTypetypes.IPFamily) ([]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 recordsResolveIP(ctxcontext.Context, namestring)string// ResolveService returns all the backend details about the containers or hosts// backing a service. Its purpose is to satisfy an SRV queryResolveService(ctxcontext.Context, namestring) ([]*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 settingsNdotsSet()bool// HandleQueryResp passes the name & IP from a response to the backend. backend// can use it to maintain any required state about the resolutionHandleQueryResp(namestring, ipnet.IP)}DNSBackend represents a backend DNS resolver used for DNS nameresolution. All the queries to the resolver are forwarded to thebackend resolver.
typeEndpoint¶
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, routeTypetypes.RouteType, nextHopnet.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¶
AddTableEntry adds a table entry to the gossip layerpassing the table name, key and an opaque value.
func (*Endpoint)DisableGatewayService¶
func (ep *Endpoint) DisableGatewayService()
DisableGatewayService tells libnetwork not to provide Default GW for the container
func (*Endpoint)DriverInfo¶
DriverInfo returns a collection of driver operational data related to this endpoint retrieved from the driver.
func (*Endpoint)Gateway¶
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¶
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)Iface¶
func (ep *Endpoint) Iface() *EndpointInterface
Iface returns information about the interface which was assigned tothe endpoint by the driver. This can be used after theendpoint has been created.
func (*Endpoint)Info¶
func (ep *Endpoint) Info()EndpointInfo
Info hydrates the endpoint and returns certain operational data belongingto 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¶
Join joins the sandbox to the endpoint and populates into the sandboxthe network resources allocated for the endpoint.
func (*Endpoint)Less¶
Less defines an ordering over endpoints, with better candidates for the defaultgateway sorted first.
<=> Returns true if a < b, false if a > b and advances to next level if a == bep.prio <=> epj.prio # 2 < 1ep.gw <=> epj.gw # non-gw < gwep.internal <=> epj.internal # non-internal < internalep.hasGw <=> epj.hasGw # (gw4 and gw6) < (gw4 or gw6) < (no gw)ep.name <=> epj.name # bar < foo
func (*Endpoint)LoadBalancer¶
LoadBalancer returns whether the endpoint is the load balancer endpoint for the network.
func (*Endpoint)MarshalJSON¶
func (*Endpoint)SetGateway¶
SetGateway sets the default IPv4 gateway when a container joins the endpoint.
func (*Endpoint)SetGatewayIPv6¶
SetGatewayIPv6 sets the default IPv6 gateway when a container joins the endpoint.
func (*Endpoint)StaticRoutes¶
func (ep *Endpoint) StaticRoutes() []*types.StaticRoute
StaticRoutes returns the list of static routes configured by the networkdriver when the container joins a network
func (*Endpoint)UnmarshalJSON¶
func (*Endpoint)UpdateDNSNames¶
typeEndpointInfo¶
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 networkStaticRoutes() []*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.
typeEndpointInterface¶
type EndpointInterface struct {// contains filtered or unexported fields}EndpointInterface holds interface addresses bound to the endpoint.
func (*EndpointInterface)Addr¶
func (epi *EndpointInterface) Addr()netip.Prefix
func (*EndpointInterface)AddrIPv6¶
func (epi *EndpointInterface) AddrIPv6()netip.Prefix
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)Copy¶
func (epi *EndpointInterface) Copy() *EndpointInterface
Copy returns a deep copy ofEndpointInterface. If the receiver is nil,Copy returns nil.
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)NetnsPath¶
func (epi *EndpointInterface) NetnsPath()string
NetnsPath returns the path of the network namespace, if there is one. Else "".
func (*EndpointInterface)SetCreatedInContainer¶
func (epi *EndpointInterface) SetCreatedInContainer(cicbool)
SetCreatedInContainer can be called by the driver to indicate that it'screated the network interface in the container's network namespace (so,it doesn't need to be moved there).
func (*EndpointInterface)SetIPAddress¶
func (epi *EndpointInterface) SetIPAddress(address *net.IPNet)error
func (*EndpointInterface)SetMacAddress¶
func (epi *EndpointInterface) SetMacAddress(macnet.HardwareAddr)error
SetMacAddress allows the driver to set the mac address to the endpoint interfaceduring the call to CreateEndpoint, if the mac address is not already set.
func (*EndpointInterface)SetNames¶
func (epi *EndpointInterface) SetNames(srcName, dstPrefix, dstNamestring)error
SetNames method assigns the srcName, dstName, and dstPrefix for theinterface. If both dstName and dstPrefix are set, dstName takes precedence.
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
typeEndpointOption¶
type EndpointOption func(ep *Endpoint)
EndpointOption is an option setter function type used to pass various options to Networkand Endpoint interfaces methods. The various setter functions of type EndpointOption areprovided by libnetwork, they look like <Create|Join|Leave>Option[...](...)
funcCreateOptionAlias¶
func CreateOptionAlias(namestring, aliasstring)EndpointOption
CreateOptionAlias function returns an option setter for setting endpoint alias
funcCreateOptionDNS¶
func CreateOptionDNS(dns []string)EndpointOption
CreateOptionDNS function returns an option setter for dns entry option tobe passed to container Create method.
funcCreateOptionDNSNames¶
func CreateOptionDNSNames(names []string)EndpointOption
CreateOptionDNSNames specifies the list of (non fully qualified) DNS names associated to an endpoint. These will beused to populate the embedded DNS server. Order matters: first name will be used to generate PTR records.
funcCreateOptionDisableIPv6¶
func CreateOptionDisableIPv6()EndpointOption
CreateOptionDisableIPv6 prevents allocation of an IPv6 address/gateway, evenif the container is connected to an IPv6-enabled network.
funcCreateOptionDisableResolution¶
func CreateOptionDisableResolution()EndpointOption
CreateOptionDisableResolution function returns an option setter to indicatethis endpoint doesn't want embedded DNS server functionality
funcCreateOptionExposedPorts¶
func CreateOptionExposedPorts(exposedPorts []types.TransportPort)EndpointOption
CreateOptionExposedPorts function returns an option setter for the container exposedports option to be passed toNetwork.CreateEndpoint method.
funcCreateOptionIPAM¶
func CreateOptionIPAM(ipV4, ipV6net.IP, llIPs []net.IP)EndpointOption
CreateOptionIPAM function returns an option setter for the ipam configuration for this endpoint
funcCreateOptionLoadBalancer¶
func CreateOptionLoadBalancer()EndpointOption
CreateOptionLoadBalancer function returns an option setter for denoting the endpoint is a load balancer for a network
funcCreateOptionPortMapping¶
func CreateOptionPortMapping(portBindings []types.PortBinding)EndpointOption
CreateOptionPortMapping function returns an option setter for the mappingports option to be passed toNetwork.CreateEndpoint method.
funcCreateOptionService¶
func CreateOptionService(name, idstring, vipnet.IP, ingressPorts []*PortConfig, aliases []string)EndpointOption
CreateOptionService function returns an option setter for setting service binding configuration
funcEndpointOptionGeneric¶
func EndpointOptionGeneric(generic map[string]any)EndpointOption
EndpointOptionGeneric function returns an option setter for a Generic option definedin a Dictionary of Key-Value pair
funcJoinOptionPriority¶
func JoinOptionPriority(prioint)EndpointOption
JoinOptionPriority function returns an option setter for priority option tobe passed to the endpoint.Join() method.
funcWithNetnsPath¶
func WithNetnsPath(pathstring)EndpointOption
typeEndpointRecord¶
type EndpointRecord struct {// Name of the containerNamestring `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`// Service name of the service to which this endpoint belongs.ServiceNamestring `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`// Service ID of the service to which this endpoint belongs.ServiceIDstring `protobuf:"bytes,3,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`// Virtual IP of the service to which this endpoint belongs.VirtualIPstring `protobuf:"bytes,4,opt,name=virtual_ip,json=virtualIp,proto3" json:"virtual_ip,omitempty"`// IP assigned to this endpoint.EndpointIPstring `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 serviceAliases []string `protobuf:"bytes,7,rep,name=aliases,proto3" json:"aliases,omitempty"`// List of aliases task specific aliasesTaskAliases []string `protobuf:"bytes,8,rep,name=task_aliases,json=taskAliases,proto3" json:"task_aliases,omitempty"`// Whether this endpoint's service has been disabledServiceDisabledbool `protobuf:"varint,9,opt,name=service_disabled,json=serviceDisabled,proto3" json:"service_disabled,omitempty"`}EndpointRecord specifies all the endpoint specific information thatneeds 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, errerror)
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() (nint)
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, deterministicbool) ([]byte,error)
func (*EndpointRecord)XXX_Merge¶
func (m *EndpointRecord) XXX_Merge(srcproto.Message)
func (*EndpointRecord)XXX_Size¶
func (m *EndpointRecord) XXX_Size()int
func (*EndpointRecord)XXX_Unmarshal¶
func (m *EndpointRecord) XXX_Unmarshal(b []byte)error
typeEndpointWalker¶
EndpointWalker is a client provided function which will be used to walk the Endpoints.When the function returns true, the walk will stop.
typeErrNoSuchNetwork¶
type ErrNoSuchNetworkstring
ErrNoSuchNetwork is returned when a network query finds no result
func (ErrNoSuchNetwork)Error¶
func (nsnErrNoSuchNetwork) Error()string
func (ErrNoSuchNetwork)NotFound¶
func (nsnErrNoSuchNetwork) NotFound()
NotFound denotes the type of this error
typeIpamConf¶
type IpamConf struct {// PreferredPool is the master address pool for containers and network interfaces.PreferredPoolstring// SubPool is a subset of the master pool. If specified,// this becomes the container pool for automatic address allocations.SubPoolstring// Gateway is the preferred Network Gateway address (optional).Gatewaystring// 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)Copy¶
Copy returns a deep copy of theIpamConf. If the receiver is nil,Copy returns nil.
func (*IpamConf)IPAMConfig¶
func (c *IpamConf) IPAMConfig()network.IPAMConfig
typeIpamInfo¶
IpamInfo contains all the ipam related operational info for a network
func (*IpamInfo)MarshalJSON¶
MarshalJSON encodes IpamInfo into json message
func (*IpamInfo)UnmarshalJSON¶
UnmarshalJSON decodes json message into PoolData
typeManagerRedirectError¶
type ManagerRedirectErrorstring
ManagerRedirectError is returned when the request should be redirected to Manager
func (ManagerRedirectError)Error¶
func (mrManagerRedirectError) Error()string
func (ManagerRedirectError)Maskable¶
func (mrManagerRedirectError) Maskable()
Maskable denotes the type of this error
typeNetwork¶
type Network struct {// contains filtered or unexported fields}Network represents a logical connectivity zone that containers mayjoin using the Link method. A network is managed by a specific driver.
func (*Network)Attachable¶
func (*Network)ConfigFrom¶
func (*Network)ConfigOnly¶
func (*Network)CreateEndpoint¶
func (n *Network) CreateEndpoint(ctxcontext.Context, namestring, options ...EndpointOption) (*Endpoint,error)
CreateEndpoint creates a new endpoint to this network symbolically identified by thespecified unique name. The options parameter carries driver specific options.
func (*Network)Delete¶
func (n *Network) Delete(options ...NetworkDeleteOption)error
Delete the network.
func (*Network)DriverOptions¶
func (*Network)EndpointByName¶
EndpointByName returns the Endpoint which has the passed name. If not found,anerrdefs.ErrNotFound is returned.
func (*Network)HasContainerAttachments¶
HasContainerAttachments returns true when len(n.Endpoints()) > 0.
func (*Network)HasServiceAttachments¶
HasServiceAttachments returns true when len(n.Services()) > 0.
func (*Network)IPAMStatus¶
func (*Network)IPv4Enabled¶
func (*Network)IPv6Enabled¶
func (*Network)IpamConfig¶
func (*Network)IsPruneable¶
IsPruneable returns true if n can be considered for removal as part of a"docker network prune" (or system prune). The caller must still check that thenetwork should be removed. For example, it may have active endpoints.
func (*Network)MarshalJSON¶
func (*Network)Peers¶
Peers returns a slice of PeerInfo structures which has the information about the peernodes participating in the same overlay network. This is currently the per-networkgossip cluster. For non-dynamic overlay networks and bridge networks it returns anempty slice
func (*Network)ResolveName¶
ResolveName looks up addresses of ipType for name req.Returns (addresses, true) if req is found, but len(addresses) may be 0 ifthere are no addresses of ipType. If the name is not found, the bool returnwill be false.
func (*Network)ResolveService¶
func (*Network)Services¶
func (n *Network) Services() map[string]ServiceInfo
Services returns a map of services keyed by the service name with the detailsof all the tasks that belong to the service. Applicable only in swarm mode.
func (*Network)TableEventRegister¶
func (n *Network) TableEventRegister(tableNamestring, objTypedriverapi.ObjectType)error
func (*Network)UnmarshalJSON¶
func (*Network)UpdateIpamConfig¶
func (*Network)WalkEndpoints¶
func (n *Network) WalkEndpoints(walkerEndpointWalker)
WalkEndpoints uses the provided function to walk the Endpoints.
typeNetworkDeleteOption¶
type NetworkDeleteOption func(p *networkDeleteParams)
NetworkDeleteOption is a type for optional parameters to pass to theNetwork.Delete() function.
typeNetworkNameError¶
type NetworkNameErrorstring
NetworkNameError is returned when a network with the same name already exists.
func (NetworkNameError)Conflict¶
func (nnrNetworkNameError) Conflict()
Conflict denotes the type of this error
func (NetworkNameError)Error¶
func (nnrNetworkNameError) Error()string
typeNetworkOption¶
type NetworkOption func(n *Network)
NetworkOption is an option setter function type used to pass various options toNewNetwork method. The various setter functions of type NetworkOption areprovided by libnetwork, they look like NetworkOptionXXXX(...)
funcNetworkOptionAttachable¶
func NetworkOptionAttachable(attachablebool)NetworkOption
NetworkOptionAttachable returns an option setter to set attachable for a network
funcNetworkOptionConfigFrom¶
func NetworkOptionConfigFrom(namestring)NetworkOption
NetworkOptionConfigFrom tells controller to pick thenetwork configuration from a configuration only network
funcNetworkOptionConfigOnly¶
func NetworkOptionConfigOnly()NetworkOption
NetworkOptionConfigOnly tells controller this network isa configuration only network. It serves as a configurationfor other networks.
funcNetworkOptionDriverOpts¶
func NetworkOptionDriverOpts(opts map[string]string)NetworkOption
NetworkOptionDriverOpts function returns an option setter for any driver parameter described by a map
funcNetworkOptionDynamic¶
func NetworkOptionDynamic()NetworkOption
NetworkOptionDynamic function returns an option setter for dynamic option for a network
funcNetworkOptionEnableIPv4¶
func NetworkOptionEnableIPv4(enableIPv4bool)NetworkOption
NetworkOptionEnableIPv4 returns an option setter to explicitly configure IPv4
funcNetworkOptionEnableIPv6¶
func NetworkOptionEnableIPv6(enableIPv6bool)NetworkOption
NetworkOptionEnableIPv6 returns an option setter to explicitly configure IPv6
funcNetworkOptionGeneric¶
func NetworkOptionGeneric(generic map[string]any)NetworkOption
NetworkOptionGeneric function returns an option setter for a Generic option definedin a Dictionary of Key-Value pair
funcNetworkOptionIngress¶
func NetworkOptionIngress(ingressbool)NetworkOption
NetworkOptionIngress returns an option setter to indicate if a network isan ingress network.
funcNetworkOptionInternalNetwork¶
func NetworkOptionInternalNetwork()NetworkOption
NetworkOptionInternalNetwork returns an option setter to config the networkto be internal which disables default gateway service
funcNetworkOptionIpam¶
func NetworkOptionIpam(ipamDriverstring, addrSpacestring, ipV4 []*IpamConf, ipV6 []*IpamConf, opts map[string]string)NetworkOption
NetworkOptionIpam function returns an option setter for the ipam configuration for this network
funcNetworkOptionLBEndpoint¶
func NetworkOptionLBEndpoint(ipnet.IP)NetworkOption
NetworkOptionLBEndpoint function returns an option setter for the configuration of the load balancer endpoint for this network
funcNetworkOptionLabels¶
func NetworkOptionLabels(labels map[string]string)NetworkOption
NetworkOptionLabels function returns an option setter for labels specific to a network
funcNetworkOptionPersist¶
func NetworkOptionPersist(persistbool)NetworkOption
NetworkOptionPersist returns an option setter to set persistence policy for a network
funcNetworkOptionScope¶
func NetworkOptionScope(scopestring)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.
typeNetworkWalker¶
NetworkWalker is a client provided function which will be used to walk the Networks.When the function returns true, the walk will stop.
typePortConfig¶
type PortConfig struct {// Name for the port. If provided the port information can// be queried using the name as in a DNS SRV query.Namestring `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`// Protocol for the port which is exposed.ProtocolPortConfig_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.TargetPortuint32 `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.PublishedPortuint32 `protobuf:"varint,4,opt,name=published_port,json=publishedPort,proto3" json:"published_port,omitempty"`}PortConfig specifies an exposed port which can beaddressed using the given name. This can be later queriedusing a service discovery api or a DNS SRV query. The nodeport specifies a port that can be used to address thisservice external to the cluster by sending a connectionrequest 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, errerror)
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() (nint)
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, deterministicbool) ([]byte,error)
func (*PortConfig)XXX_Merge¶
func (m *PortConfig) XXX_Merge(srcproto.Message)
func (*PortConfig)XXX_Size¶
func (m *PortConfig) XXX_Size()int
func (*PortConfig)XXX_Unmarshal¶
func (m *PortConfig) XXX_Unmarshal(b []byte)error
typePortConfig_Protocol¶
type PortConfig_Protocolint32
const (ProtocolTCPPortConfig_Protocol = 0ProtocolUDPPortConfig_Protocol = 1ProtocolSCTPPortConfig_Protocol = 2)
func (PortConfig_Protocol)EnumDescriptor¶
func (PortConfig_Protocol) EnumDescriptor() ([]byte, []int)
func (PortConfig_Protocol)String¶
func (xPortConfig_Protocol) String()string
typeResolver¶
type Resolver struct {// contains filtered or unexported fields}Resolver is the embedded DNS server in Docker. It operates by listening onthe container's loopback interface for DNS queries.
funcNewResolver¶
func NewResolver(addressstring, proxyDNSbool, backendDNSBackend) *Resolver
NewResolver creates a new instance of the Resolver
func (*Resolver)NameServer¶
NameServer returns the IP of the DNS resolver for the containers.
func (*Resolver)ResolverOptions¶
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 usewhen forwarding queries, unless SetExtServersForSrc has configured serversfor the DNS client making the request.
func (*Resolver)SetExtServersForSrc¶
SetExtServersForSrc configures the external nameservers the resolver shoulduse when forwarding queries from srcAddr. If set, these servers will be usedin preference to servers set by SetExtServers. Supplying a nil or empty extDNSdeletes nameservers for srcAddr.
func (*Resolver)SetForwardingPolicy¶
SetForwardingPolicy re-configures the embedded DNS resolver to either enable or disable forwarding DNS queries toexternal servers.
func (*Resolver)SetupFunc¶
SetupFunc returns the setup function that should be run in the container'snetwork namespace.
typeSandbox¶
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)AddHostsEntry¶
AddHostsEntry adds an entry to /etc/hosts.
func (*Sandbox)ContainerID¶
ContainerID returns the container id associated to this sandbox.
func (*Sandbox)Delete¶
Delete destroys this container after detaching it from all connected endpoints.
func (*Sandbox)DisableService¶
DisableService removes a managed container's endpoints from the load balancerand service discovery.
func (*Sandbox)EnableService¶
EnableService makes a managed container's service available by adding theendpoint to the service load balancer and service discovery.
func (*Sandbox)GetEndpoint¶
func (*Sandbox)IPv6Enabled¶
IPv6Enabled determines whether a container supports IPv6.IPv6 support can always be determined for host networking. For other networktypes it can only be determined once there's a container namespace to probe,return ok=false in that case.
func (*Sandbox)MarshalJSON¶
func (*Sandbox)NetnsPath¶
NetnsPath returns the network namespace's path and true, if a network has beencreated - else the empty string and false.
func (*Sandbox)Refresh¶
func (sb *Sandbox) Refresh(ctxcontext.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)ResolveName¶
func (*Sandbox)ResolveService¶
ResolveService returns all the backend details about the containers or hostsbacking a service. Its purpose is to satisfy an SRV query.
func (*Sandbox)Statistics¶
func (sb *Sandbox) Statistics() (map[string]*types.InterfaceStatistics,error)
Statistics retrieves the interfaces' statistics for the sandbox.
func (*Sandbox)UnmarshalJSON¶
func (*Sandbox)UpdateHostsEntry¶
UpdateHostsEntry updates the IP address in a /etc/hosts entry where thename matches the regular expression regexp.
func (*Sandbox)UpdateLabels¶
typeSandboxOption¶
type SandboxOption func(sb *Sandbox)
SandboxOption is an option setter function type used to pass various options toNewNetContainer method. The various setter functions of type SandboxOption areprovided by libnetwork, they look like ContainerOptionXXXX(...)
funcOptionDNS¶
func OptionDNS(dns []netip.Addr)SandboxOption
OptionDNS function returns an option setter for dns entry option tobe passed to container Create method.
funcOptionDNSOptions¶
func OptionDNSOptions(options []string)SandboxOption
OptionDNSOptions function returns an option setter for dns options entry option tobe passed to container Create method.
funcOptionDNSSearch¶
func OptionDNSSearch(search []string)SandboxOption
OptionDNSSearch function returns an option setter for dns search entry option tobe passed to container Create method.
funcOptionDomainname¶
func OptionDomainname(namestring)SandboxOption
OptionDomainname function returns an option setter for domainname option tobe passed to NewSandbox method.
funcOptionExposedPorts¶
func OptionExposedPorts(exposedPorts []types.TransportPort)SandboxOption
OptionExposedPorts function returns an option setter for the container exposedports option to be passed to container Create method.
funcOptionExtraHost¶
func OptionExtraHost(namestring, IPnetip.Addr)SandboxOption
OptionExtraHost function returns an option setter for extra /etc/hosts optionswhich is a name and IP as strings.
funcOptionHostname¶
func OptionHostname(namestring)SandboxOption
OptionHostname function returns an option setter for hostname option tobe passed to NewSandbox method.
funcOptionHostsPath¶
func OptionHostsPath(pathstring)SandboxOption
OptionHostsPath function returns an option setter for hostspath option tobe passed to NewSandbox method.
funcOptionIngress¶
func OptionIngress()SandboxOption
OptionIngress function returns an option setter for marking asandbox as the controller's ingress sandbox.
funcOptionLoadBalancer¶
func OptionLoadBalancer(nidstring)SandboxOption
OptionLoadBalancer function returns an option setter for marking asandbox as a load balancer sandbox.
funcOptionOriginHostsPath¶
func OptionOriginHostsPath(pathstring)SandboxOption
OptionOriginHostsPath function returns an option setter for origin hosts file pathto be passed to NewSandbox method.
funcOptionOriginResolvConfPath¶
func OptionOriginResolvConfPath(pathstring)SandboxOption
OptionOriginResolvConfPath function returns an option setter to set the path to theorigin resolv.conf file to be passed to net container methods.
funcOptionPortMapping¶
func OptionPortMapping(portBindings []types.PortBinding)SandboxOption
OptionPortMapping function returns an option setter for the mappingports option to be passed to container Create method.
funcOptionResolvConfPath¶
func OptionResolvConfPath(pathstring)SandboxOption
OptionResolvConfPath function returns an option setter for resolvconfpath option tobe passed to net container methods.
funcOptionUseDefaultSandbox¶
func OptionUseDefaultSandbox()SandboxOption
OptionUseDefaultSandbox function returns an option setter for using default sandbox(host namespace) to be passed to container Create method.
funcOptionUseExternalKey¶
func OptionUseExternalKey()SandboxOption
OptionUseExternalKey function returns an option setter for using provided namespaceinstead of creating one.
typeServiceInfo¶
ServiceInfo has service specific details along with the list of backend tasks
Source Files¶
- agent.go
- agent.pb.go
- controller.go
- controller_linux.go
- default_gateway.go
- default_gateway_linux.go
- drivers_linux.go
- endpoint.go
- endpoint_cnt.go
- endpoint_info.go
- endpoint_info_unix.go
- endpoint_store.go
- error.go
- firewall_linux.go
- network.go
- network_store.go
- network_unix.go
- resolver.go
- resolver_unix.go
- sandbox.go
- sandbox_dns_unix.go
- sandbox_externalkey_unix.go
- sandbox_linux.go
- sandbox_options.go
- sandbox_store.go
- service.go
- service_common.go
- service_linux.go
- store.go
Directories¶
| Path | Synopsis |
|---|---|
Package bitmap provides a datatype for long vectors of bits. | Package bitmap provides a datatype for long vectors of bits. |
cmd | |
diagnosticcommand | |
networkdb-testcommand | |
drivers | |
bridge/internal/firewaller Package firewaller defines an interface that can be used to manipulate firewall configuration for a bridge network. | Package firewaller defines an interface that can be used to manipulate firewall configuration for a bridge network. |
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. |
internal | |
addrset Package addrset implements a set of IP addresses. | Package addrset implements a set of IP addresses. |
hashable Package hashable provides handy utility types for making unhashable values hashable. | Package hashable provides handy utility types for making unhashable values hashable. |
modprobe Package modprobe attempts to load kernel modules. | Package modprobe attempts to load kernel modules. |
nftables Package nftables provides methods to create an nftables table and manage its maps, sets, chains, and rules. | Package nftables provides methods to create an nftables table and manage its maps, sets, chains, and rules. |
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 nlwrap wraps vishvandanda/netlink functions that may return EINTR. | Package nlwrap wraps vishvandanda/netlink functions that may return EINTR. |
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. |
Package osl describes structures and interfaces which abstract os entities | Package osl describes structures and interfaces which abstract os entities |
portmappers | |
Package resolvconf provides utility code to get the host's "resolv.conf" path. | Package resolvconf provides utility code to get the host's "resolv.conf" path. |
Package types contains types that are common across libnetwork project | Package types contains types that are common across libnetwork project |