Documentation
¶
Index ¶
- Constants
- type ConfigReference
- type ConnectRequest
- type CreateRequest
- type CreateResponse
- type DisconnectRequest
- type EndpointIPAMConfig
- type EndpointResource
- type EndpointSettings
- type HardwareAddr
- type IPAM
- type IPAMConfig
- type IPAMStatus
- type IPProtocol
- type Inspect
- type Network
- type NetworkingConfig
- type PeerInfo
- type Port
- func (p Port) AppendText(b []byte) ([]byte, error)
- func (p Port) AppendTo(b []byte) []byte
- func (p Port) IsValid() bool
- func (p Port) IsZero() bool
- func (p Port) MarshalText() ([]byte, error)
- func (p Port) Num() uint16
- func (p Port) Proto() IPProtocol
- func (p Port) Range() PortRange
- func (p Port) String() string
- func (p *Port) UnmarshalText(text []byte) error
- type PortBinding
- type PortMap
- type PortRange
- func (pr PortRange) All() iter.Seq[Port]
- func (pr PortRange) AppendText(b []byte) ([]byte, error)
- func (pr PortRange) AppendTo(b []byte) []byte
- func (pr PortRange) End() uint16
- func (pr PortRange) IsValid() bool
- func (pr PortRange) IsZero() bool
- func (pr PortRange) MarshalText() ([]byte, error)
- func (pr PortRange) Proto() IPProtocol
- func (pr PortRange) Range() PortRange
- func (pr PortRange) Start() uint16
- func (pr PortRange) String() string
- func (pr *PortRange) UnmarshalText(text []byte) error
- type PortSet
- type PruneReport
- type ServiceInfo
- type Status
- type SubnetStatus
- type SubnetStatuses
- type Summary
- type Task
Constants ¶
const ( // NetworkDefault is a platform-independent alias to choose the platform-specific default network stack. NetworkDefault = "default" // NetworkHost is the name of the predefined network used when the NetworkMode host is selected (only available on Linux) NetworkHost = "host" // NetworkNone is the name of the predefined network used when the NetworkMode none is selected (available on both Linux and Windows) NetworkNone = "none" // NetworkBridge is the name of the default network on Linux NetworkBridge = "bridge" // NetworkNat is the name of the default network on Windows NetworkNat = "nat" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigReference ¶
type ConfigReference struct {
// The name of the config-only network that provides the network's
// configuration. The specified network must be an existing config-only
// network. Only network names are allowed, not network IDs.
//
// Example: config_only_network_01
Network string `json:"Network"`
}
ConfigReference The config-only network source to provide the configuration for this network.
swagger:model ConfigReference
type ConnectRequest ¶
type ConnectRequest struct {
// The ID or name of the container to connect to the network.
// Example: 3613f73ba0e4
// Required: true
Container string `json:"Container"`
// endpoint config
EndpointConfig *EndpointSettings `json:"EndpointConfig,omitempty"`
}
ConnectRequest NetworkConnectRequest represents the data to be used to connect a container to a network.
swagger:model ConnectRequest
type CreateRequest ¶
type CreateRequest struct {
Name string // Name is the requested name of the network.
Driver string // Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`)
Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level).
EnableIPv4 *bool `json:",omitempty"` // EnableIPv4 represents whether to enable IPv4.
EnableIPv6 *bool `json:",omitempty"` // EnableIPv6 represents whether to enable IPv6.
IPAM *IPAM // IPAM is the network's IP Address Management.
Internal bool // Internal represents if the network is used internal only.
Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode.
Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster.
ConfigOnly bool // ConfigOnly creates a config-only network. Config-only networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services.
ConfigFrom *ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network. The specified network must be a config-only network; see [CreateOptions.ConfigOnly].
Options map[string]string // Options specifies the network-specific options to use for when creating the network.
Labels map[string]string // Labels holds metadata specific to the network being created.
}
CreateRequest is the request message sent to the server for network create call.
type CreateResponse ¶
type CreateResponse struct {
// The ID of the created network.
// Example: b5c4fc71e8022147cd25de22b22173de4e3b170134117172eb595cb91b4e7e5d
// Required: true
ID string `json:"Id"`
// Warnings encountered when creating the container
// Required: true
Warning string `json:"Warning"`
}
CreateResponse NetworkCreateResponse
OK response to NetworkCreate operation ¶
swagger:model CreateResponse
type DisconnectRequest ¶
type DisconnectRequest struct {
// The ID or name of the container to disconnect from the network.
// Example: 3613f73ba0e4
// Required: true
Container string `json:"Container"`
// Force the container to disconnect from the network.
// Example: false
Force bool `json:"Force"`
}
DisconnectRequest NetworkDisconnectRequest represents the data to be used to disconnect a container from a network.
swagger:model DisconnectRequest
type EndpointIPAMConfig ¶
type EndpointIPAMConfig struct {
IPv4Address netip.Addr `json:",omitempty"`
IPv6Address netip.Addr `json:",omitempty"`
LinkLocalIPs []netip.Addr `json:",omitempty"`
}
EndpointIPAMConfig represents IPAM configurations for the endpoint
func (*EndpointIPAMConfig) Copy ¶
func (cfg *EndpointIPAMConfig) Copy() *EndpointIPAMConfig
Copy makes a copy of the endpoint ipam config
type EndpointResource ¶
type EndpointResource struct {
// name
// Example: container_1
Name string `json:"Name"`
// endpoint ID
// Example: 628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a
EndpointID string `json:"EndpointID"`
// mac address
// Example: 02:42:ac:13:00:02
MacAddress HardwareAddr `json:"MacAddress"`
// IPv4 address
// Example: 172.19.0.2/16
IPv4Address netip.Prefix `json:"IPv4Address"`
// IPv6 address
IPv6Address netip.Prefix `json:"IPv6Address"`
}
EndpointResource contains network resources allocated and used for a container in a network.
swagger:model EndpointResource
type EndpointSettings ¶
type EndpointSettings struct {
// Configuration data
IPAMConfig *EndpointIPAMConfig
Links []string
Aliases []string // Aliases holds the list of extra, user-specified DNS names for this endpoint.
DriverOpts map[string]string
// GwPriority determines which endpoint will provide the default gateway
// for the container. The endpoint with the highest priority will be used.
// If multiple endpoints have the same priority, they are lexicographically
// sorted based on their network name, and the one that sorts first is picked.
GwPriority int
NetworkID string
EndpointID string
Gateway netip.Addr
IPAddress netip.Addr
// MacAddress may be used to specify a MAC address when the container is created.
// Once the container is running, it becomes operational data (it may contain a
// generated address).
MacAddress HardwareAddr
IPPrefixLen int
IPv6Gateway netip.Addr
GlobalIPv6Address netip.Addr
GlobalIPv6PrefixLen int
// DNSNames holds all the (non fully qualified) DNS names associated to this
// endpoint. The first entry is used to generate PTR records.
DNSNames []string
}
EndpointSettings stores the network endpoint details
func (*EndpointSettings) Copy ¶
func (es *EndpointSettings) Copy() *EndpointSettings
Copy makes a deep copy of `EndpointSettings`
type HardwareAddr ¶
type HardwareAddr net.HardwareAddr
A HardwareAddr represents a physical hardware address. It implements encoding.TextMarshaler and encoding.TextUnmarshaler in the absence of go.dev/issue/29678.
func (HardwareAddr) MarshalText ¶
func (m HardwareAddr) MarshalText() ([]byte, error)
func (HardwareAddr) String ¶
func (m HardwareAddr) String() string
func (*HardwareAddr) UnmarshalText ¶
func (m *HardwareAddr) UnmarshalText(text []byte) error
type IPAM ¶
type IPAM struct {
Driver string
Options map[string]string // Per network IPAM driver options
Config []IPAMConfig
}
IPAM represents IP Address Management
type IPAMConfig ¶
type IPAMConfig struct {
Subnet netip.Prefix `json:",omitempty"`
IPRange netip.Prefix `json:",omitempty"`
Gateway netip.Addr `json:",omitempty"`
AuxAddress map[string]netip.Addr `json:"AuxiliaryAddresses,omitempty"`
}
IPAMConfig represents IPAM configurations
type IPAMStatus ¶
type IPAMStatus struct {
// subnets
// Example: {"172.16.0.0/16":{"DynamicIPsAvailable":65533,"IPsInUse":3},"2001:db8:abcd:0012::0/96":{"DynamicIPsAvailable":4294967291,"IPsInUse":5}}
Subnets SubnetStatuses `json:"Subnets,omitempty"`
}
IPAMStatus IPAM status
swagger:model IPAMStatus
type IPProtocol ¶
type IPProtocol string
IPProtocol represents a network protocol for a port.
const ( TCP IPProtocol = "tcp" UDP IPProtocol = "udp" SCTP IPProtocol = "sctp" )
type Inspect ¶
type Inspect struct {
Network
// Contains endpoints attached to the network.
//
// Example: {"19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c":{"EndpointID":"628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a","IPv4Address":"172.19.0.2/16","IPv6Address":"","MacAddress":"02:42:ac:13:00:02","Name":"test"}}
Containers map[string]EndpointResource `json:"Containers"`
// List of services using the network. This field is only present for
// swarm scope networks, and omitted for local scope networks.
//
Services map[string]ServiceInfo `json:"Services,omitempty"`
// provides runtime information about the network such as the number of allocated IPs.
//
Status *Status `json:"Status,omitempty"`
}
Inspect The body of the "get network" http response message.
swagger:model Inspect
type Network ¶
type Network struct {
// Name of the network.
//
// Example: my_network
Name string `json:"Name"`
// ID that uniquely identifies a network on a single machine.
//
// Example: 7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99
ID string `json:"Id"`
// Date and time at which the network was created in
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
//
// Example: 2016-10-19T04:33:30.360899459Z
Created timeext.Time `json:"Created"`
// The level at which the network exists (e.g. `swarm` for cluster-wide
// or `local` for machine level)
//
// Example: local
Scope string `json:"Scope"`
// The name of the driver used to create the network (e.g. `bridge`,
// `overlay`).
//
// Example: overlay
Driver string `json:"Driver"`
// Whether the network was created with IPv4 enabled.
//
// Example: true
EnableIPv4 bool `json:"EnableIPv4"`
// Whether the network was created with IPv6 enabled.
//
// Example: false
EnableIPv6 bool `json:"EnableIPv6"`
// The network's IP Address Management.
//
IPAM IPAM `json:"IPAM"`
// Whether the network is created to only allow internal networking
// connectivity.
//
// Example: false
Internal bool `json:"Internal"`
// Whether a global / swarm scope network is manually attachable by regular
// containers from workers in swarm mode.
//
// Example: false
Attachable bool `json:"Attachable"`
// Whether the network is providing the routing-mesh for the swarm cluster.
//
// Example: false
Ingress bool `json:"Ingress"`
// config from
ConfigFrom ConfigReference `json:"ConfigFrom"`
// Whether the network is a config-only network. Config-only networks are
// placeholder networks for network configurations to be used by other
// networks. Config-only networks cannot be used directly to run containers
// or services.
//
ConfigOnly bool `json:"ConfigOnly"`
// Network-specific options uses when creating the network.
//
// Example: {"com.docker.network.bridge.default_bridge":"true","com.docker.network.bridge.enable_icc":"true","com.docker.network.bridge.enable_ip_masquerade":"true","com.docker.network.bridge.host_binding_ipv4":"0.0.0.0","com.docker.network.bridge.name":"docker0","com.docker.network.driver.mtu":"1500"}
Options map[string]string `json:"Options"`
// Metadata specific to the network being created.
//
// Example: {"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"}
Labels map[string]string `json:"Labels"`
// List of peer nodes for an overlay network. This field is only present
// for overlay networks, and omitted for other network types.
//
Peers []PeerInfo `json:"Peers,omitempty"`
}
Network network
swagger:model Network
type NetworkingConfig ¶
type NetworkingConfig struct {
EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network
}
NetworkingConfig represents the container's networking configuration for each of its interfaces Carries the networking configs specified in the `docker run` and `docker network connect` commands
type PeerInfo ¶
type PeerInfo struct {
// ID of the peer-node in the Swarm cluster.
// Example: 6869d7c1732b
Name string `json:"Name"`
// IP-address of the peer-node in the Swarm cluster.
// Example: 10.133.77.91
IP netip.Addr `json:"IP"`
}
PeerInfo represents one peer of an overlay network.
swagger:model PeerInfo
type Port ¶
type Port struct {
// contains filtered or unexported fields
}
Port is a type representing a single port number and protocol in the format "<portnum>/[<proto>]".
The zero port value, i.e. Port{}, is invalid; use ParsePort to create a valid Port value.
func MustParsePort ¶
MustParsePort calls ParsePort(s) and panics on error.
It is intended for use in tests with hard-coded strings.
func ParsePort ¶
ParsePort parses s as a Port.
It normalizes the provided protocol such that "80/tcp", "80/TCP", and "80/tCp" are equivalent. If a port number is provided, but no protocol, the default ("tcp") protocol is returned.
func PortFrom ¶
func PortFrom(num uint16, proto IPProtocol) (p Port, ok bool)
PortFrom returns a Port with the given number and protocol.
If no protocol is specified (i.e. proto == ""), then PortFrom returns Port{}, false.
func (Port) AppendText ¶
AppendText implements encoding.TextAppender interface. It is the same as Port.AppendTo but returns an error to satisfy the interface.
func (Port) MarshalText ¶
MarshalText implements encoding.TextMarshaler interface.
func (Port) String ¶
String returns a string representation of the port in the format "<portnum>/<proto>". If the port is the zero value, it returns "invalid port".
func (*Port) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler interface.
type PortBinding ¶
type PortBinding struct {
// HostIP is the host IP Address
HostIP netip.Addr `json:"HostIp"`
// HostPort is the host port number
HostPort string `json:"HostPort"`
}
PortBinding represents a binding between a Host IP address and a Host Port.
type PortMap ¶
type PortMap = map[Port][]PortBinding
PortMap is a collection of PortBinding indexed by Port.
type PortRange ¶
type PortRange struct {
// contains filtered or unexported fields
}
PortRange represents a range of port numbers and a protocol in the format "8000-9000/tcp".
The zero port range value, i.e. PortRange{}, is invalid; use ParsePortRange to create a valid PortRange value.
func MustParsePortRange ¶
MustParsePortRange calls ParsePortRange(s) and panics on error. It is intended for use in tests with hard-coded strings.
func ParsePortRange ¶
ParsePortRange parses s as a PortRange.
It normalizes the provided protocol such that "80-90/tcp", "80-90/TCP", and "80-90/tCp" are equivalent. If a port number range is provided, but no protocol, the default ("tcp") protocol is returned.
func PortRangeFrom ¶
func PortRangeFrom(start, end uint16, proto IPProtocol) (pr PortRange, ok bool)
PortRangeFrom returns a PortRange with the given start and end port numbers and protocol.
If end < start or no protocol is specified (i.e. proto == ""), then PortRangeFrom returns PortRange{}, false.
func (PortRange) All ¶
All returns an iterator over all the individual ports in the range.
For example:
for port := range pr.All() {
// ...
}
func (PortRange) AppendText ¶
AppendText implements encoding.TextAppender interface. It is the same as PortRange.AppendTo but returns an error to satisfy the interface.
func (PortRange) AppendTo ¶
AppendTo appends a text encoding of pr to b and returns the extended buffer.
func (PortRange) IsValid ¶
IsValid reports whether pr is an initialized valid port range (not the zero value).
func (PortRange) MarshalText ¶
MarshalText implements encoding.TextMarshaler interface.
func (PortRange) Proto ¶
func (pr PortRange) Proto() IPProtocol
Proto returns pr's network protocol.
func (PortRange) String ¶
String returns a string representation of the port range in the format "<start>-<end>/<proto>" or "<portnum>/<proto>" if start == end. If the port range is the zero value, it returns "invalid port range".
func (*PortRange) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler interface.
type PruneReport ¶
type PruneReport struct {
NetworksDeleted []string
}
PruneReport contains the response for Engine API: POST "/networks/prune"
type ServiceInfo ¶
type ServiceInfo struct {
// v IP
VIP netip.Addr `json:"VIP"`
// ports
Ports []string `json:"Ports"`
// local l b index
LocalLBIndex int `json:"LocalLBIndex"`
// tasks
Tasks []Task `json:"Tasks"`
}
ServiceInfo represents service parameters with the list of service's tasks
swagger:model ServiceInfo
type Status ¶
type Status struct {
// IPAM
IPAM IPAMStatus `json:"IPAM"`
}
Status provides runtime information about the network such as the number of allocated IPs.
swagger:model Status
type SubnetStatus ¶
type SubnetStatus struct {
// Number of IP addresses in the subnet that are in use or reserved and are therefore unavailable for allocation, saturating at 2<sup>64</sup> - 1.
//
IPsInUse uint64 `json:"IPsInUse"`
// Number of IP addresses within the network's IPRange for the subnet that are available for allocation, saturating at 2<sup>64</sup> - 1.
//
DynamicIPsAvailable uint64 `json:"DynamicIPsAvailable"`
}
SubnetStatus subnet status
swagger:model SubnetStatus
type SubnetStatuses ¶
type SubnetStatuses = map[netip.Prefix]SubnetStatus