Documentation
¶
Overview ¶
Package network names the networks containers join, as Docker's `network` commands do: "bridge" (the default) and the networks created by `wctr network create` are in-engine networks (netdriver.Local, with DNS by container name on every one of them, "bridge" included); "none" is no network; and drivers registered by the host — a class network through the relay — appear under their own names.
Index ¶
- Constants
- Variables
- type Manager
- func (m *Manager) Attach(ctx context.Context, network, name string) (netdriver.Endpoint, error)
- func (m *Manager) Close()
- func (m *Manager) Create(name string, labels map[string]string) (Network, error)
- func (m *Manager) Default() string
- func (m *Manager) Get(ref string) (Network, error)
- func (m *Manager) List() []Network
- func (m *Manager) Remove(ref string, inUse func(name string) bool) error
- type Network
- type Options
Constants ¶
const ( Bridge = "bridge" None = "none" Host = "host" )
Names the engine reserves.
const MaxNetworks = 64
MaxNetworks bounds the networks `network create` may make.
Variables ¶
var ( // ErrNotFound is a network that does not exist. ErrNotFound = errors.New("network: not found") // ErrExists is a create of a name in use. ErrExists = errors.New("network: already exists") // ErrInUse is a remove of a network a container uses. ErrInUse = errors.New("network: in use") // ErrInvalid is a bad name or an operation a network refuses. ErrInvalid = errors.New("network: invalid") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager holds the engine's networks.
func New ¶
New returns a manager with "bridge" and "none", the host drivers, and the networks created before (from Store); a damaged record is skipped and reported.
func (*Manager) Attach ¶
Attach puts a container on a network ("" = the default) under its DNS name; it is container.Options.Network.
func (*Manager) Create ¶
Create makes an in-engine network on the next free /16 of 10.89.0.0 onwards.
type Network ¶
type Network struct {
Name string
ID string
Driver string // "bridge" (in-engine), "null", or a host driver's name
Subnet string // empty for none and host drivers
Created time.Time
Labels map[string]string
// Builtin networks cannot be removed.
Builtin bool
}
Network is what `network ls` and `inspect` show.
type Options ¶
type Options struct {
// Store keeps created networks across restarts (nil: memory only).
Store state.Store
// Drivers are host-provided networks by name (e.g. "class" through the
// relay). Their names are reserved.
Drivers map[string]netdriver.NetworkDriver
// DriverName describes a host driver in `network ls` (default
// "remote").
DriverName string
}
Options configures a Manager.