Movatterモバイル変換


[0]ホーム

URL:


network

package
v1.52.0Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License:Apache-2.0Imports:12Imported by:97

Details

Repository

github.com/moby/moby

Links

Documentation

Index

Constants

View Source
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 LinuxNetworkBridge = "bridge"// NetworkNat is the name of the default network on WindowsNetworkNat = "nat")

Variables

This section is empty.

Functions

This section is empty.

Types

typeConfigReference

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_01Networkstring `json:"Network"`}

ConfigReference The config-only network source to provide the configuration forthis network.

swagger:model ConfigReference

typeConnectRequest

type ConnectRequest struct {// The ID or name of the container to connect to the network.// Example: 3613f73ba0e4// Required: trueContainerstring `json:"Container"`// endpoint configEndpointConfig *EndpointSettings `json:"EndpointConfig,omitempty"`}

ConnectRequest NetworkConnectRequest represents the data to be used to connect a container to a network.

swagger:model ConnectRequest

typeCreateRequest

type CreateRequest struct {Namestring// Name is the requested name of the network.Driverstring// Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`)Scopestring// 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.Internalbool// Internal represents if the network is used internal only.Attachablebool// Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode.Ingressbool// Ingress indicates the network is providing the routing-mesh for the swarm cluster.ConfigOnlybool// 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.

typeCreateResponse

type CreateResponse struct {// The ID of the created network.// Example: b5c4fc71e8022147cd25de22b22173de4e3b170134117172eb595cb91b4e7e5d// Required: trueIDstring `json:"Id"`// Warnings encountered when creating the container// Required: trueWarningstring `json:"Warning"`}

CreateResponse NetworkCreateResponse

OK response to NetworkCreate operation

swagger:model CreateResponse

typeDisconnectRequest

type DisconnectRequest struct {// The ID or name of the container to disconnect from the network.// Example: 3613f73ba0e4// Required: trueContainerstring `json:"Container"`// Force the container to disconnect from the network.// Example: falseForcebool `json:"Force"`}

DisconnectRequest NetworkDisconnectRequest represents the data to be used to disconnect a container from a network.

swagger:model DisconnectRequest

typeEndpointIPAMConfig

type EndpointIPAMConfig struct {IPv4Addressnetip.Addr   `json:",omitempty"`IPv6Addressnetip.Addr   `json:",omitempty"`LinkLocalIPs []netip.Addr `json:",omitempty"`}

EndpointIPAMConfig represents IPAM configurations for the endpoint

func (*EndpointIPAMConfig)Copy

Copy makes a copy of the endpoint ipam config

typeEndpointResource

type EndpointResource struct {// name// Example: container_1Namestring `json:"Name"`// endpoint ID// Example: 628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21aEndpointIDstring `json:"EndpointID"`// mac address// Example: 02:42:ac:13:00:02MacAddressHardwareAddr `json:"MacAddress"`// IPv4 address// Example: 172.19.0.2/16IPv4Addressnetip.Prefix `json:"IPv4Address"`// IPv6 addressIPv6Addressnetip.Prefix `json:"IPv6Address"`}

EndpointResource contains network resources allocated and used for a container in a network.

swagger:model EndpointResource

typeEndpointSettings

type EndpointSettings struct {// Configuration dataIPAMConfig *EndpointIPAMConfigLinks      []stringAliases    []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.GwPriorityintNetworkIDstringEndpointIDstringGatewaynetip.AddrIPAddressnetip.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).MacAddressHardwareAddrIPPrefixLenintIPv6Gatewaynetip.AddrGlobalIPv6Addressnetip.AddrGlobalIPv6PrefixLenint// 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

Copy makes a deep copy of `EndpointSettings`

typeHardwareAddr

type HardwareAddrnet.HardwareAddr

A HardwareAddr represents a physical hardware address.It implementsencoding.TextMarshaler andencoding.TextUnmarshalerin the absence of go.dev/issue/29678.

func (HardwareAddr)MarshalText

func (mHardwareAddr) MarshalText() ([]byte,error)

func (HardwareAddr)String

func (mHardwareAddr) String()string

func (*HardwareAddr)UnmarshalText

func (m *HardwareAddr) UnmarshalText(text []byte)error

typeIPAM

type IPAM struct {DriverstringOptions map[string]string// Per network IPAM driver optionsConfig  []IPAMConfig}

IPAM represents IP Address Management

typeIPAMConfig

type IPAMConfig struct {Subnetnetip.Prefix          `json:",omitempty"`IPRangenetip.Prefix          `json:",omitempty"`Gatewaynetip.Addr            `json:",omitempty"`AuxAddress map[string]netip.Addr `json:"AuxiliaryAddresses,omitempty"`}

IPAMConfig represents IPAM configurations

typeIPAMStatus

type IPAMStatus struct {// subnets// Example: {"172.16.0.0/16":{"DynamicIPsAvailable":65533,"IPsInUse":3},"2001:db8:abcd:0012::0/96":{"DynamicIPsAvailable":4294967291,"IPsInUse":5}}SubnetsSubnetStatuses `json:"Subnets,omitempty"`}

IPAMStatus IPAM status

swagger:model IPAMStatus

typeIPProtocol

type IPProtocolstring

IPProtocol represents a network protocol for a port.

const (TCPIPProtocol = "tcp"UDPIPProtocol = "udp"SCTPIPProtocol = "sctp")

typeInspect

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

typeNetwork

type Network struct {// Name of the network.//// Example: my_networkNamestring `json:"Name"`// ID that uniquely identifies a network on a single machine.//// Example: 7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99IDstring `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.360899459ZCreatedtimeext.Time `json:"Created"`// The level at which the network exists (e.g. `swarm` for cluster-wide// or `local` for machine level)//// Example: localScopestring `json:"Scope"`// The name of the driver used to create the network (e.g. `bridge`,// `overlay`).//// Example: overlayDriverstring `json:"Driver"`// Whether the network was created with IPv4 enabled.//// Example: trueEnableIPv4bool `json:"EnableIPv4"`// Whether the network was created with IPv6 enabled.//// Example: falseEnableIPv6bool `json:"EnableIPv6"`// The network's IP Address Management.//IPAMIPAM `json:"IPAM"`// Whether the network is created to only allow internal networking// connectivity.//// Example: falseInternalbool `json:"Internal"`// Whether a global / swarm scope network is manually attachable by regular// containers from workers in swarm mode.//// Example: falseAttachablebool `json:"Attachable"`// Whether the network is providing the routing-mesh for the swarm cluster.//// Example: falseIngressbool `json:"Ingress"`// config fromConfigFromConfigReference `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.//ConfigOnlybool `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

typeNetworkingConfig

type NetworkingConfig struct {EndpointsConfig map[string]*EndpointSettings// Endpoint configs for each connecting network}

NetworkingConfig represents the container's networking configuration for each of its interfacesCarries the networking configs specified in the `docker run` and `docker network connect` commands

typePeerInfo

type PeerInfo struct {// ID of the peer-node in the Swarm cluster.// Example: 6869d7c1732bNamestring `json:"Name"`// IP-address of the peer-node in the Swarm cluster.// Example: 10.133.77.91IPnetip.Addr `json:"IP"`}

PeerInfo represents one peer of an overlay network.

swagger:model PeerInfo

typePort

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; useParsePort to create a valid Port value.

funcMustParsePort

func MustParsePort(sstring)Port

MustParsePort callsParsePort(s) and panics on error.

It is intended for use in tests with hard-coded strings.

funcParsePort

func ParsePort(sstring) (Port,error)

ParsePort parses s as aPort.

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.

funcPortFrom

func PortFrom(numuint16, protoIPProtocol) (pPort, okbool)

PortFrom returns aPort with the given number and protocol.

If no protocol is specified (i.e. proto == ""), then PortFrom returns Port{}, false.

func (Port)AppendText

func (pPort) AppendText(b []byte) ([]byte,error)

AppendText implementsencoding.TextAppender interface.It is the same asPort.AppendTo but returns an error to satisfy the interface.

func (Port)AppendTo

func (pPort) AppendTo(b []byte) []byte

AppendTo appends a text encoding of p to b and returns the extended buffer.

func (Port)IsValid

func (pPort) IsValid()bool

IsValid reports whether p is an initialized valid port (not the zero value).

func (Port)IsZero

func (pPort) IsZero()bool

IsZero reports whether p is the zero value.

func (Port)MarshalText

func (pPort) MarshalText() ([]byte,error)

MarshalText implementsencoding.TextMarshaler interface.

func (Port)Num

func (pPort) Num()uint16

Num returns p's port number.

func (Port)Proto

func (pPort) Proto()IPProtocol

Proto returns p's network protocol.

func (Port)Range

func (pPort) Range()PortRange

Range returns aPortRange representing the single port.

func (Port)String

func (pPort) String()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

func (p *Port) UnmarshalText(text []byte)error

UnmarshalText implementsencoding.TextUnmarshaler interface.

typePortBinding

type PortBinding struct {// HostIP is the host IP AddressHostIPnetip.Addr `json:"HostIp"`// HostPort is the host port numberHostPortstring `json:"HostPort"`}

PortBinding represents a binding between a Host IP address and a Host Port.

typePortMap

type PortMap = map[Port][]PortBinding

PortMap is a collection ofPortBinding indexed byPort.

typePortRange

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; useParsePortRange to create a valid PortRange value.

funcMustParsePortRange

func MustParsePortRange(sstring)PortRange

MustParsePortRange callsParsePortRange(s) and panics on error.It is intended for use in tests with hard-coded strings.

funcParsePortRange

func ParsePortRange(sstring) (PortRange,error)

ParsePortRange parses s as aPortRange.

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.

funcPortRangeFrom

func PortRangeFrom(start, enduint16, protoIPProtocol) (prPortRange, okbool)

PortRangeFrom returns aPortRange 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

func (prPortRange) All()iter.Seq[Port]

All returns an iterator over all the individual ports in the range.

For example:

for port := range pr.All() {    // ...}

func (PortRange)AppendText

func (prPortRange) AppendText(b []byte) ([]byte,error)

AppendText implementsencoding.TextAppender interface.It is the same asPortRange.AppendTo but returns an error to satisfy the interface.

func (PortRange)AppendTo

func (prPortRange) AppendTo(b []byte) []byte

AppendTo appends a text encoding of pr to b and returns the extended buffer.

func (PortRange)End

func (prPortRange) End()uint16

End returns pr's end port number.

func (PortRange)IsValid

func (prPortRange) IsValid()bool

IsValid reports whether pr is an initialized valid port range (not the zero value).

func (PortRange)IsZero

func (prPortRange) IsZero()bool

IsZero reports whether pr is the zero value.

func (PortRange)MarshalText

func (prPortRange) MarshalText() ([]byte,error)

MarshalText implementsencoding.TextMarshaler interface.

func (PortRange)Proto

func (prPortRange) Proto()IPProtocol

Proto returns pr's network protocol.

func (PortRange)Range

func (prPortRange) Range()PortRange

Range returns pr.

func (PortRange)Start

func (prPortRange) Start()uint16

Start returns pr's start port number.

func (PortRange)String

func (prPortRange) String()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

func (pr *PortRange) UnmarshalText(text []byte)error

UnmarshalText implementsencoding.TextUnmarshaler interface.

typePortSet

type PortSet = map[Port]struct{}

PortSet is a collection of structs indexed byPort.

typePruneReport

type PruneReport struct {NetworksDeleted []string}

PruneReport contains the response for Engine API:POST "/networks/prune"

typeServiceInfo

type ServiceInfo struct {// v IPVIPnetip.Addr `json:"VIP"`// portsPorts []string `json:"Ports"`// local l b indexLocalLBIndexint `json:"LocalLBIndex"`// tasksTasks []Task `json:"Tasks"`}

ServiceInfo represents service parameters with the list of service's tasks

swagger:model ServiceInfo

typeStatus

type Status struct {// IPAMIPAMIPAMStatus `json:"IPAM"`}

Status provides runtime information about the network such as the number of allocated IPs.

swagger:model Status

typeSubnetStatus

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.//IPsInUseuint64 `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.//DynamicIPsAvailableuint64 `json:"DynamicIPsAvailable"`}

SubnetStatus subnet status

swagger:model SubnetStatus

typeSubnetStatuses

type SubnetStatuses = map[netip.Prefix]SubnetStatus

typeSummary

type Summary struct {Network}

Summary Network list response item

swagger:model Summary

typeTask

type Task struct {// nameNamestring `json:"Name"`// endpoint IDEndpointIDstring `json:"EndpointID"`// endpoint IPEndpointIPnetip.Addr `json:"EndpointIP"`// infoInfo map[string]string `json:"Info"`}

Task carries the information about one backend task

swagger:model Task

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp