Registry for IPAM drivers with registration, lookup, and iteration.
// Source: https://github.com/moby/moby | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package drvregistry
import (
"errors"
"strings"
"sync"
"github.com/moby/moby/v2/daemon/libnetwork/ipamapi"
"github.com/moby/moby/v2/daemon/libnetwork/types"
)
type ipamDriver struct {
driver ipamapi.Ipam
capability *ipamapi.Capability
}
// IPAMs is a registry of IPAM drivers. The zero value is an empty IPAM driver
// registry, ready to use.
type IPAMs struct {
mu sync.Mutex
drivers map[string]ipamDriver
}
var _ ipamapi.Registerer = (*IPAMs)(nil)
// IPAM returns the actual IPAM driver instance and its capability which registered with the passed name.
func (ir *IPAMs) IPAM
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key