aboutsummaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/docker/docker/opts/address_pools.go84
-rw-r--r--vendor/github.com/docker/docker/opts/env.go30
-rw-r--r--vendor/github.com/docker/docker/opts/hosts.go183
-rw-r--r--vendor/github.com/docker/docker/opts/hosts_unix.go12
-rw-r--r--vendor/github.com/docker/docker/opts/hosts_windows.go60
-rw-r--r--vendor/github.com/docker/docker/opts/ip.go47
-rw-r--r--vendor/github.com/docker/docker/opts/opts.go348
-rw-r--r--vendor/github.com/docker/docker/opts/quotedstring.go37
-rw-r--r--vendor/github.com/docker/docker/opts/runtime.go79
-rw-r--r--vendor/github.com/docker/docker/opts/ulimit.go81
-rw-r--r--vendor/github.com/docker/libnetwork/LICENSE202
-rw-r--r--vendor/github.com/docker/libnetwork/ipamutils/utils.go135
-rw-r--r--vendor/modules.txt4
13 files changed, 0 insertions, 1302 deletions
diff --git a/vendor/github.com/docker/docker/opts/address_pools.go b/vendor/github.com/docker/docker/opts/address_pools.go
deleted file mode 100644
index fa15c24b9..000000000
--- a/vendor/github.com/docker/docker/opts/address_pools.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package opts
-
-import (
- "encoding/csv"
- "encoding/json"
- "fmt"
- "strconv"
- "strings"
-
- types "github.com/docker/libnetwork/ipamutils"
-)
-
-// PoolsOpt is a Value type for parsing the default address pools definitions
-type PoolsOpt struct {
- Values []*types.NetworkToSplit
-}
-
-// UnmarshalJSON fills values structure info from JSON input
-func (p *PoolsOpt) UnmarshalJSON(raw []byte) error {
- return json.Unmarshal(raw, &(p.Values))
-}
-
-// Set predefined pools
-func (p *PoolsOpt) Set(value string) error {
- csvReader := csv.NewReader(strings.NewReader(value))
- fields, err := csvReader.Read()
- if err != nil {
- return err
- }
-
- poolsDef := types.NetworkToSplit{}
-
- for _, field := range fields {
- parts := strings.SplitN(field, "=", 2)
- if len(parts) != 2 {
- return fmt.Errorf("invalid field '%s' must be a key=value pair", field)
- }
-
- key := strings.ToLower(parts[0])
- value := strings.ToLower(parts[1])
-
- switch key {
- case "base":
- poolsDef.Base = value
- case "size":
- size, err := strconv.Atoi(value)
- if err != nil {
- return fmt.Errorf("invalid size value: %q (must be integer): %v", value, err)
- }
- poolsDef.Size = size
- default:
- return fmt.Errorf("unexpected key '%s' in '%s'", key, field)
- }
- }
-
- p.Values = append(p.Values, &poolsDef)
-
- return nil
-}
-
-// Type returns the type of this option
-func (p *PoolsOpt) Type() string {
- return "pool-options"
-}
-
-// String returns a string repr of this option
-func (p *PoolsOpt) String() string {
- var pools []string
- for _, pool := range p.Values {
- repr := fmt.Sprintf("%s %d", pool.Base, pool.Size)
- pools = append(pools, repr)
- }
- return strings.Join(pools, ", ")
-}
-
-// Value returns the mounts
-func (p *PoolsOpt) Value() []*types.NetworkToSplit {
- return p.Values
-}
-
-// Name returns the flag name of this option
-func (p *PoolsOpt) Name() string {
- return "default-address-pools"
-}
diff --git a/vendor/github.com/docker/docker/opts/env.go b/vendor/github.com/docker/docker/opts/env.go
deleted file mode 100644
index 97e1a8c8a..000000000
--- a/vendor/github.com/docker/docker/opts/env.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package opts // import "github.com/docker/docker/opts"
-
-import (
- "os"
- "strings"
-
- "github.com/pkg/errors"
-)
-
-// ValidateEnv validates an environment variable and returns it.
-// If no value is specified, it obtains its value from the current environment
-//
-// As on ParseEnvFile and related to #16585, environment variable names
-// are not validate whatsoever, it's up to application inside docker
-// to validate them or not.
-//
-// The only validation here is to check if name is empty, per #25099
-func ValidateEnv(val string) (string, error) {
- arr := strings.SplitN(val, "=", 2)
- if arr[0] == "" {
- return "", errors.New("invalid environment variable: " + val)
- }
- if len(arr) > 1 {
- return val, nil
- }
- if envVal, ok := os.LookupEnv(arr[0]); ok {
- return arr[0] + "=" + envVal, nil
- }
- return val, nil
-}
diff --git a/vendor/github.com/docker/docker/opts/hosts.go b/vendor/github.com/docker/docker/opts/hosts.go
deleted file mode 100644
index a3123adef..000000000
--- a/vendor/github.com/docker/docker/opts/hosts.go
+++ /dev/null
@@ -1,183 +0,0 @@
-package opts // import "github.com/docker/docker/opts"
-
-import (
- "fmt"
- "net"
- "net/url"
- "path/filepath"
- "strconv"
- "strings"
-
- "github.com/docker/docker/pkg/homedir"
-)
-
-const (
- // DefaultHTTPPort Default HTTP Port used if only the protocol is provided to -H flag e.g. dockerd -H tcp://
- // These are the IANA registered port numbers for use with Docker
- // see http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=docker
- DefaultHTTPPort = 2375 // Default HTTP Port
- // DefaultTLSHTTPPort Default HTTP Port used when TLS enabled
- DefaultTLSHTTPPort = 2376 // Default TLS encrypted HTTP Port
- // DefaultUnixSocket Path for the unix socket.
- // Docker daemon by default always listens on the default unix socket
- DefaultUnixSocket = "/var/run/docker.sock"
- // DefaultTCPHost constant defines the default host string used by docker on Windows
- DefaultTCPHost = "tcp://" + DefaultHTTPHost + ":2375"
- // DefaultTLSHost constant defines the default host string used by docker for TLS sockets
- DefaultTLSHost = "tcp://" + DefaultHTTPHost + ":2376"
- // DefaultNamedPipe defines the default named pipe used by docker on Windows
- DefaultNamedPipe = `//./pipe/docker_engine`
- // HostGatewayName is the string value that can be passed
- // to the IPAddr section in --add-host that is replaced by
- // the value of HostGatewayIP daemon config value
- HostGatewayName = "host-gateway"
-)
-
-// ValidateHost validates that the specified string is a valid host and returns it.
-func ValidateHost(val string) (string, error) {
- host := strings.TrimSpace(val)
- // The empty string means default and is not handled by parseDaemonHost
- if host != "" {
- _, err := parseDaemonHost(host)
- if err != nil {
- return val, err
- }
- }
- // Note: unlike most flag validators, we don't return the mutated value here
- // we need to know what the user entered later (using ParseHost) to adjust for TLS
- return val, nil
-}
-
-// ParseHost and set defaults for a Daemon host string.
-// defaultToTLS is preferred over defaultToUnixXDG.
-func ParseHost(defaultToTLS, defaultToUnixXDG bool, val string) (string, error) {
- host := strings.TrimSpace(val)
- if host == "" {
- if defaultToTLS {
- host = DefaultTLSHost
- } else if defaultToUnixXDG {
- runtimeDir, err := homedir.GetRuntimeDir()
- if err != nil {
- return "", err
- }
- socket := filepath.Join(runtimeDir, "docker.sock")
- host = "unix://" + socket
- } else {
- host = DefaultHost
- }
- } else {
- var err error
- host, err = parseDaemonHost(host)
- if err != nil {
- return val, err
- }
- }
- return host, nil
-}
-
-// parseDaemonHost parses the specified address and returns an address that will be used as the host.
-// Depending of the address specified, this may return one of the global Default* strings defined in hosts.go.
-func parseDaemonHost(addr string) (string, error) {
- addrParts := strings.SplitN(addr, "://", 2)
- if len(addrParts) == 1 && addrParts[0] != "" {
- addrParts = []string{"tcp", addrParts[0]}
- }
-
- switch addrParts[0] {
- case "tcp":
- return ParseTCPAddr(addrParts[1], DefaultTCPHost)
- case "unix":
- return parseSimpleProtoAddr("unix", addrParts[1], DefaultUnixSocket)
- case "npipe":
- return parseSimpleProtoAddr("npipe", addrParts[1], DefaultNamedPipe)
- case "fd":
- return addr, nil
- default:
- return "", fmt.Errorf("Invalid bind address format: %s", addr)
- }
-}
-
-// parseSimpleProtoAddr parses and validates that the specified address is a valid
-// socket address for simple protocols like unix and npipe. It returns a formatted
-// socket address, either using the address parsed from addr, or the contents of
-// defaultAddr if addr is a blank string.
-func parseSimpleProtoAddr(proto, addr, defaultAddr string) (string, error) {
- addr = strings.TrimPrefix(addr, proto+"://")
- if strings.Contains(addr, "://") {
- return "", fmt.Errorf("Invalid proto, expected %s: %s", proto, addr)
- }
- if addr == "" {
- addr = defaultAddr
- }
- return fmt.Sprintf("%s://%s", proto, addr), nil
-}
-
-// ParseTCPAddr parses and validates that the specified address is a valid TCP
-// address. It returns a formatted TCP address, either using the address parsed
-// from tryAddr, or the contents of defaultAddr if tryAddr is a blank string.
-// tryAddr is expected to have already been Trim()'d
-// defaultAddr must be in the full `tcp://host:port` form
-func ParseTCPAddr(tryAddr string, defaultAddr string) (string, error) {
- if tryAddr == "" || tryAddr == "tcp://" {
- return defaultAddr, nil
- }
- addr := strings.TrimPrefix(tryAddr, "tcp://")
- if strings.Contains(addr, "://") || addr == "" {
- return "", fmt.Errorf("Invalid proto, expected tcp: %s", tryAddr)
- }
-
- defaultAddr = strings.TrimPrefix(defaultAddr, "tcp://")
- defaultHost, defaultPort, err := net.SplitHostPort(defaultAddr)
- if err != nil {
- return "", err
- }
- // url.Parse fails for trailing colon on IPv6 brackets on Go 1.5, but
- // not 1.4. See https://github.com/golang/go/issues/12200 and
- // https://github.com/golang/go/issues/6530.
- if strings.HasSuffix(addr, "]:") {
- addr += defaultPort
- }
-
- u, err := url.Parse("tcp://" + addr)
- if err != nil {
- return "", err
- }
- host, port, err := net.SplitHostPort(u.Host)
- if err != nil {
- // try port addition once
- host, port, err = net.SplitHostPort(net.JoinHostPort(u.Host, defaultPort))
- }
- if err != nil {
- return "", fmt.Errorf("Invalid bind address format: %s", tryAddr)
- }
-
- if host == "" {
- host = defaultHost
- }
- if port == "" {
- port = defaultPort
- }
- p, err := strconv.Atoi(port)
- if err != nil && p == 0 {
- return "", fmt.Errorf("Invalid bind address format: %s", tryAddr)
- }
-
- return fmt.Sprintf("tcp://%s%s", net.JoinHostPort(host, port), u.Path), nil
-}
-
-// ValidateExtraHost validates that the specified string is a valid extrahost and returns it.
-// ExtraHost is in the form of name:ip where the ip has to be a valid ip (IPv4 or IPv6).
-func ValidateExtraHost(val string) (string, error) {
- // allow for IPv6 addresses in extra hosts by only splitting on first ":"
- arr := strings.SplitN(val, ":", 2)
- if len(arr) != 2 || len(arr[0]) == 0 {
- return "", fmt.Errorf("bad format for add-host: %q", val)
- }
- // Skip IPaddr validation for special "host-gateway" string
- if arr[1] != HostGatewayName {
- if _, err := ValidateIPAddress(arr[1]); err != nil {
- return "", fmt.Errorf("invalid IP address in add-host: %q", arr[1])
- }
- }
- return val, nil
-}
diff --git a/vendor/github.com/docker/docker/opts/hosts_unix.go b/vendor/github.com/docker/docker/opts/hosts_unix.go
deleted file mode 100644
index 4b1c8512e..000000000
--- a/vendor/github.com/docker/docker/opts/hosts_unix.go
+++ /dev/null
@@ -1,12 +0,0 @@
-//go:build !windows
-// +build !windows
-
-package opts // import "github.com/docker/docker/opts"
-
-const (
- // DefaultHTTPHost Default HTTP Host used if only port is provided to -H flag e.g. dockerd -H tcp://:8080
- DefaultHTTPHost = "localhost"
-
- // DefaultHost constant defines the default host string used by docker on other hosts than Windows
- DefaultHost = "unix://" + DefaultUnixSocket
-)
diff --git a/vendor/github.com/docker/docker/opts/hosts_windows.go b/vendor/github.com/docker/docker/opts/hosts_windows.go
deleted file mode 100644
index 576236ba4..000000000
--- a/vendor/github.com/docker/docker/opts/hosts_windows.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package opts // import "github.com/docker/docker/opts"
-
-const (
- // TODO Windows. Identify bug in GOLang 1.5.1+ and/or Windows Server 2016 TP5.
- //
- // On Windows, this mitigates a problem with the default options of running
- // a docker client against a local docker daemon on TP5.
- //
- // What was found that if the default host is "localhost", even if the client
- // (and daemon as this is local) is not physically on a network, and the DNS
- // cache is flushed (ipconfig /flushdns), then the client will pause for
- // exactly one second when connecting to the daemon for calls. For example
- // using docker run windowsservercore cmd, the CLI will send a create followed
- // by an attach. You see the delay between the attach finishing and the attach
- // being seen by the daemon.
- //
- // Here's some daemon debug logs with additional debug spew put in. The
- // AfterWriteJSON log is the very last thing the daemon does as part of the
- // create call. The POST /attach is the second CLI call. Notice the second
- // time gap.
- //
- // time="2015-11-06T13:38:37.259627400-08:00" level=debug msg="After createRootfs"
- // time="2015-11-06T13:38:37.263626300-08:00" level=debug msg="After setHostConfig"
- // time="2015-11-06T13:38:37.267631200-08:00" level=debug msg="before createContainerPl...."
- // time="2015-11-06T13:38:37.271629500-08:00" level=debug msg=ToDiskLocking....
- // time="2015-11-06T13:38:37.275643200-08:00" level=debug msg="loggin event...."
- // time="2015-11-06T13:38:37.277627600-08:00" level=debug msg="logged event...."
- // time="2015-11-06T13:38:37.279631800-08:00" level=debug msg="In defer func"
- // time="2015-11-06T13:38:37.282628100-08:00" level=debug msg="After daemon.create"
- // time="2015-11-06T13:38:37.286651700-08:00" level=debug msg="return 2"
- // time="2015-11-06T13:38:37.289629500-08:00" level=debug msg="Returned from daemon.ContainerCreate"
- // time="2015-11-06T13:38:37.311629100-08:00" level=debug msg="After WriteJSON"
- // ... 1 second gap here....
- // time="2015-11-06T13:38:38.317866200-08:00" level=debug msg="Calling POST /v1.22/containers/984758282b842f779e805664b2c95d563adc9a979c8a3973e68c807843ee4757/attach"
- // time="2015-11-06T13:38:38.326882500-08:00" level=info msg="POST /v1.22/containers/984758282b842f779e805664b2c95d563adc9a979c8a3973e68c807843ee4757/attach?stderr=1&stdin=1&stdout=1&stream=1"
- //
- // We suspect this is either a bug introduced in GOLang 1.5.1, or that a change
- // in GOLang 1.5.1 (from 1.4.3) is exposing a bug in Windows. In theory,
- // the Windows networking stack is supposed to resolve "localhost" internally,
- // without hitting DNS, or even reading the hosts file (which is why localhost
- // is commented out in the hosts file on Windows).
- //
- // We have validated that working around this using the actual IPv4 localhost
- // address does not cause the delay.
- //
- // This does not occur with the docker client built with 1.4.3 on the same
- // Windows build, regardless of whether the daemon is built using 1.5.1
- // or 1.4.3. It does not occur on Linux. We also verified we see the same thing
- // on a cross-compiled Windows binary (from Linux).
- //
- // Final note: This is a mitigation, not a 'real' fix. It is still susceptible
- // to the delay if a user were to do 'docker run -H=tcp://localhost:2375...'
- // explicitly.
-
- // DefaultHTTPHost Default HTTP Host used if only port is provided to -H flag e.g. dockerd -H tcp://:8080
- DefaultHTTPHost = "127.0.0.1"
-
- // DefaultHost constant defines the default host string used by docker on Windows
- DefaultHost = "npipe://" + DefaultNamedPipe
-)
diff --git a/vendor/github.com/docker/docker/opts/ip.go b/vendor/github.com/docker/docker/opts/ip.go
deleted file mode 100644
index cfbff3a9f..000000000
--- a/vendor/github.com/docker/docker/opts/ip.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package opts // import "github.com/docker/docker/opts"
-
-import (
- "fmt"
- "net"
-)
-
-// IPOpt holds an IP. It is used to store values from CLI flags.
-type IPOpt struct {
- *net.IP
-}
-
-// NewIPOpt creates a new IPOpt from a reference net.IP and a
-// string representation of an IP. If the string is not a valid
-// IP it will fallback to the specified reference.
-func NewIPOpt(ref *net.IP, defaultVal string) *IPOpt {
- o := &IPOpt{
- IP: ref,
- }
- o.Set(defaultVal)
- return o
-}
-
-// Set sets an IPv4 or IPv6 address from a given string. If the given
-// string is not parsable as an IP address it returns an error.
-func (o *IPOpt) Set(val string) error {
- ip := net.ParseIP(val)
- if ip == nil {
- return fmt.Errorf("%s is not an ip address", val)
- }
- *o.IP = ip
- return nil
-}
-
-// String returns the IP address stored in the IPOpt. If stored IP is a
-// nil pointer, it returns an empty string.
-func (o *IPOpt) String() string {
- if *o.IP == nil {
- return ""
- }
- return o.IP.String()
-}
-
-// Type returns the type of the option
-func (o *IPOpt) Type() string {
- return "ip"
-}
diff --git a/vendor/github.com/docker/docker/opts/opts.go b/vendor/github.com/docker/docker/opts/opts.go
deleted file mode 100644
index 60a093f28..000000000
--- a/vendor/github.com/docker/docker/opts/opts.go
+++ /dev/null
@@ -1,348 +0,0 @@
-package opts // import "github.com/docker/docker/opts"
-
-import (
- "fmt"
- "net"
- "path"
- "regexp"
- "strings"
-
- units "github.com/docker/go-units"
-)
-
-var (
- alphaRegexp = regexp.MustCompile(`[a-zA-Z]`)
- domainRegexp = regexp.MustCompile(`^(:?(:?[a-zA-Z0-9]|(:?[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]))(:?\.(:?[a-zA-Z0-9]|(:?[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])))*)\.?\s*$`)
-)
-
-// ListOpts holds a list of values and a validation function.
-type ListOpts struct {
- values *[]string
- validator ValidatorFctType
-}
-
-// NewListOpts creates a new ListOpts with the specified validator.
-func NewListOpts(validator ValidatorFctType) ListOpts {
- var values []string
- return *NewListOptsRef(&values, validator)
-}
-
-// NewListOptsRef creates a new ListOpts with the specified values and validator.
-func NewListOptsRef(values *[]string, validator ValidatorFctType) *ListOpts {
- return &ListOpts{
- values: values,
- validator: validator,
- }
-}
-
-func (opts *ListOpts) String() string {
- if len(*opts.values) == 0 {
- return ""
- }
- return fmt.Sprintf("%v", *opts.values)
-}
-
-// Set validates if needed the input value and adds it to the
-// internal slice.
-func (opts *ListOpts) Set(value string) error {
- if opts.validator != nil {
- v, err := opts.validator(value)
- if err != nil {
- return err
- }
- value = v
- }
- *opts.values = append(*opts.values, value)
- return nil
-}
-
-// Delete removes the specified element from the slice.
-func (opts *ListOpts) Delete(key string) {
- for i, k := range *opts.values {
- if k == key {
- *opts.values = append((*opts.values)[:i], (*opts.values)[i+1:]...)
- return
- }
- }
-}
-
-// GetMap returns the content of values in a map in order to avoid
-// duplicates.
-func (opts *ListOpts) GetMap() map[string]struct{} {
- ret := make(map[string]struct{})
- for _, k := range *opts.values {
- ret[k] = struct{}{}
- }
- return ret
-}
-
-// GetAll returns the values of slice.
-func (opts *ListOpts) GetAll() []string {
- return *opts.values
-}
-
-// GetAllOrEmpty returns the values of the slice
-// or an empty slice when there are no values.
-func (opts *ListOpts) GetAllOrEmpty() []string {
- v := *opts.values
- if v == nil {
- return make([]string, 0)
- }
- return v
-}
-
-// Get checks the existence of the specified key.
-func (opts *ListOpts) Get(key string) bool {
- for _, k := range *opts.values {
- if k == key {
- return true
- }
- }
- return false
-}
-
-// Len returns the amount of element in the slice.
-func (opts *ListOpts) Len() int {
- return len(*opts.values)
-}
-
-// Type returns a string name for this Option type
-func (opts *ListOpts) Type() string {
- return "list"
-}
-
-// WithValidator returns the ListOpts with validator set.
-func (opts *ListOpts) WithValidator(validator ValidatorFctType) *ListOpts {
- opts.validator = validator
- return opts
-}
-
-// NamedOption is an interface that list and map options
-// with names implement.
-type NamedOption interface {
- Name() string
-}
-
-// NamedListOpts is a ListOpts with a configuration name.
-// This struct is useful to keep reference to the assigned
-// field name in the internal configuration struct.
-type NamedListOpts struct {
- name string
- ListOpts
-}
-
-var _ NamedOption = &NamedListOpts{}
-
-// NewNamedListOptsRef creates a reference to a new NamedListOpts struct.
-func NewNamedListOptsRef(name string, values *[]string, validator ValidatorFctType) *NamedListOpts {
- return &NamedListOpts{
- name: name,
- ListOpts: *NewListOptsRef(values, validator),
- }
-}
-
-// Name returns the name of the NamedListOpts in the configuration.
-func (o *NamedListOpts) Name() string {
- return o.name
-}
-
-// MapOpts holds a map of values and a validation function.
-type MapOpts struct {
- values map[string]string
- validator ValidatorFctType
-}
-
-// Set validates if needed the input value and add it to the
-// internal map, by splitting on '='.
-func (opts *MapOpts) Set(value string) error {
- if opts.validator != nil {
- v, err := opts.validator(value)
- if err != nil {
- return err
- }
- value = v
- }
- vals := strings.SplitN(value, "=", 2)
- if len(vals) == 1 {
- (opts.values)[vals[0]] = ""
- } else {
- (opts.values)[vals[0]] = vals[1]
- }
- return nil
-}
-
-// GetAll returns the values of MapOpts as a map.
-func (opts *MapOpts) GetAll() map[string]string {
- return opts.values
-}
-
-func (opts *MapOpts) String() string {
- return fmt.Sprintf("%v", opts.values)
-}
-
-// Type returns a string name for this Option type
-func (opts *MapOpts) Type() string {
- return "map"
-}
-
-// NewMapOpts creates a new MapOpts with the specified map of values and a validator.
-func NewMapOpts(values map[string]string, validator ValidatorFctType) *MapOpts {
- if values == nil {
- values = make(map[string]string)
- }
- return &MapOpts{
- values: values,
- validator: validator,
- }
-}
-
-// NamedMapOpts is a MapOpts struct with a configuration name.
-// This struct is useful to keep reference to the assigned
-// field name in the internal configuration struct.
-type NamedMapOpts struct {
- name string
- MapOpts
-}
-
-var _ NamedOption = &NamedMapOpts{}
-
-// NewNamedMapOpts creates a reference to a new NamedMapOpts struct.
-func NewNamedMapOpts(name string, values map[string]string, validator ValidatorFctType) *NamedMapOpts {
- return &NamedMapOpts{
- name: name,
- MapOpts: *NewMapOpts(values, validator),
- }
-}
-
-// Name returns the name of the NamedMapOpts in the configuration.
-func (o *NamedMapOpts) Name() string {
- return o.name
-}
-
-// ValidatorFctType defines a validator function that returns a validated string and/or an error.
-type ValidatorFctType func(val string) (string, error)
-
-// ValidatorFctListType defines a validator function that returns a validated list of string and/or an error
-type ValidatorFctListType func(val string) ([]string, error)
-
-// ValidateIPAddress validates an Ip address.
-func ValidateIPAddress(val string) (string, error) {
- var ip = net.ParseIP(strings.TrimSpace(val))
- if ip != nil {
- return ip.String(), nil
- }
- return "", fmt.Errorf("%s is not an ip address", val)
-}
-
-// ValidateDNSSearch validates domain for resolvconf search configuration.
-// A zero length domain is represented by a dot (.).
-func ValidateDNSSearch(val string) (string, error) {
- if val = strings.Trim(val, " "); val == "." {
- return val, nil
- }
- return validateDomain(val)
-}
-
-func validateDomain(val string) (string, error) {
- if alphaRegexp.FindString(val) == "" {
- return "", fmt.Errorf("%s is not a valid domain", val)
- }
- ns := domainRegexp.FindSubmatch([]byte(val))
- if len(ns) > 0 && len(ns[1]) < 255 {
- return string(ns[1]), nil
- }
- return "", fmt.Errorf("%s is not a valid domain", val)
-}
-
-// ValidateLabel validates that the specified string is a valid label,
-// it does not use the reserved namespaces com.docker.*, io.docker.*, org.dockerproject.*
-// and returns it.
-// Labels are in the form on key=value.
-func ValidateLabel(val string) (string, error) {
- if strings.Count(val, "=") < 1 {
- return "", fmt.Errorf("bad attribute format: %s", val)
- }
-
- lowered := strings.ToLower(val)
- if strings.HasPrefix(lowered, "com.docker.") || strings.HasPrefix(lowered, "io.docker.") ||
- strings.HasPrefix(lowered, "org.dockerproject.") {
- return "", fmt.Errorf(
- "label %s is not allowed: the namespaces com.docker.*, io.docker.*, and org.dockerproject.* are reserved for internal use",
- val)
- }
-
- return val, nil
-}
-
-// ValidateSingleGenericResource validates that a single entry in the
-// generic resource list is valid.
-// i.e 'GPU=UID1' is valid however 'GPU:UID1' or 'UID1' isn't
-func ValidateSingleGenericResource(val string) (string, error) {
- if strings.Count(val, "=") < 1 {
- return "", fmt.Errorf("invalid node-generic-resource format `%s` expected `name=value`", val)
- }
- return val, nil
-}
-
-// ParseLink parses and validates the specified string as a link format (name:alias)
-func ParseLink(val string) (string, string, error) {
- if val == "" {
- return "", "", fmt.Errorf("empty string specified for links")
- }
- arr := strings.Split(val, ":")
- if len(arr) > 2 {
- return "", "", fmt.Errorf("bad format for links: %s", val)
- }
- if len(arr) == 1 {
- return val, val, nil
- }
- // This is kept because we can actually get a HostConfig with links
- // from an already created container and the format is not `foo:bar`
- // but `/foo:/c1/bar`
- if strings.HasPrefix(arr[0], "/") {
- _, alias := path.Split(arr[1])
- return arr[0][1:], alias, nil
- }
- return arr[0], arr[1], nil
-}
-
-// MemBytes is a type for human readable memory bytes (like 128M, 2g, etc)
-type MemBytes int64
-
-// String returns the string format of the human readable memory bytes
-func (m *MemBytes) String() string {
- // NOTE: In spf13/pflag/flag.go, "0" is considered as "zero value" while "0 B" is not.
- // We return "0" in case value is 0 here so that the default value is hidden.
- // (Sometimes "default 0 B" is actually misleading)
- if m.Value() != 0 {
- return units.BytesSize(float64(m.Value()))
- }
- return "0"
-}
-
-// Set sets the value of the MemBytes by passing a string
-func (m *MemBytes) Set(value string) error {
- val, err := units.RAMInBytes(value)
- *m = MemBytes(val)
- return err
-}
-
-// Type returns the type
-func (m *MemBytes) Type() string {
- return "bytes"
-}
-
-// Value returns the value in int64
-func (m *MemBytes) Value() int64 {
- return int64(*m)
-}
-
-// UnmarshalJSON is the customized unmarshaler for MemBytes
-func (m *MemBytes) UnmarshalJSON(s []byte) error {
- if len(s) <= 2 || s[0] != '"' || s[len(s)-1] != '"' {
- return fmt.Errorf("invalid size: %q", s)
- }
- val, err := units.RAMInBytes(string(s[1 : len(s)-1]))
- *m = MemBytes(val)
- return err
-}
diff --git a/vendor/github.com/docker/docker/opts/quotedstring.go b/vendor/github.com/docker/docker/opts/quotedstring.go
deleted file mode 100644
index 6c889070e..000000000
--- a/vendor/github.com/docker/docker/opts/quotedstring.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package opts // import "github.com/docker/docker/opts"
-
-// QuotedString is a string that may have extra quotes around the value. The
-// quotes are stripped from the value.
-type QuotedString struct {
- value *string
-}
-
-// Set sets a new value
-func (s *QuotedString) Set(val string) error {
- *s.value = trimQuotes(val)
- return nil
-}
-
-// Type returns the type of the value
-func (s *QuotedString) Type() string {
- return "string"
-}
-
-func (s *QuotedString) String() string {
- return *s.value
-}
-
-func trimQuotes(value string) string {
- lastIndex := len(value) - 1
- for _, char := range []byte{'\'', '"'} {
- if value[0] == char && value[lastIndex] == char {
- return value[1:lastIndex]
- }
- }
- return value
-}
-
-// NewQuotedString returns a new quoted string option
-func NewQuotedString(value *string) *QuotedString {
- return &QuotedString{value: value}
-}
diff --git a/vendor/github.com/docker/docker/opts/runtime.go b/vendor/github.com/docker/docker/opts/runtime.go
deleted file mode 100644
index 4b9babf0a..000000000
--- a/vendor/github.com/docker/docker/opts/runtime.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package opts // import "github.com/docker/docker/opts"
-
-import (
- "fmt"
- "strings"
-
- "github.com/docker/docker/api/types"
-)
-
-// RuntimeOpt defines a map of Runtimes
-type RuntimeOpt struct {
- name string
- stockRuntimeName string
- values *map[string]types.Runtime
-}
-
-// NewNamedRuntimeOpt creates a new RuntimeOpt
-func NewNamedRuntimeOpt(name string, ref *map[string]types.Runtime, stockRuntime string) *RuntimeOpt {
- if ref == nil {
- ref = &map[string]types.Runtime{}
- }
- return &RuntimeOpt{name: name, values: ref, stockRuntimeName: stockRuntime}
-}
-
-// Name returns the name of the NamedListOpts in the configuration.
-func (o *RuntimeOpt) Name() string {
- return o.name
-}
-
-// Set validates and updates the list of Runtimes
-func (o *RuntimeOpt) Set(val string) error {
- parts := strings.SplitN(val, "=", 2)
- if len(parts) != 2 {
- return fmt.Errorf("invalid runtime argument: %s", val)
- }
-
- parts[0] = strings.TrimSpace(parts[0])
- parts[1] = strings.TrimSpace(parts[1])
- if parts[0] == "" || parts[1] == "" {
- return fmt.Errorf("invalid runtime argument: %s", val)
- }
-
- parts[0] = strings.ToLower(parts[0])
- if parts[0] == o.stockRuntimeName {
- return fmt.Errorf("runtime name '%s' is reserved", o.stockRuntimeName)
- }
-
- if _, ok := (*o.values)[parts[0]]; ok {
- return fmt.Errorf("runtime '%s' was already defined", parts[0])
- }
-
- (*o.values)[parts[0]] = types.Runtime{Path: parts[1]}
-
- return nil
-}
-
-// String returns Runtime values as a string.
-func (o *RuntimeOpt) String() string {
- var out []string
- for k := range *o.values {
- out = append(out, k)
- }
-
- return fmt.Sprintf("%v", out)
-}
-
-// GetMap returns a map of Runtimes (name: path)
-func (o *RuntimeOpt) GetMap() map[string]types.Runtime {
- if o.values != nil {
- return *o.values
- }
-
- return map[string]types.Runtime{}
-}
-
-// Type returns the type of the option
-func (o *RuntimeOpt) Type() string {
- return "runtime"
-}
diff --git a/vendor/github.com/docker/docker/opts/ulimit.go b/vendor/github.com/docker/docker/opts/ulimit.go
deleted file mode 100644
index 61cc58d4d..000000000
--- a/vendor/github.com/docker/docker/opts/ulimit.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package opts // import "github.com/docker/docker/opts"
-
-import (
- "fmt"
-
- units "github.com/docker/go-units"
-)
-
-// UlimitOpt defines a map of Ulimits
-type UlimitOpt struct {
- values *map[string]*units.Ulimit
-}
-
-// NewUlimitOpt creates a new UlimitOpt
-func NewUlimitOpt(ref *map[string]*units.Ulimit) *UlimitOpt {
- if ref == nil {
- ref = &map[string]*units.Ulimit{}
- }
- return &UlimitOpt{ref}
-}
-
-// Set validates a Ulimit and sets its name as a key in UlimitOpt
-func (o *UlimitOpt) Set(val string) error {
- l, err := units.ParseUlimit(val)
- if err != nil {
- return err
- }
-
- (*o.values)[l.Name] = l
-
- return nil
-}
-
-// String returns Ulimit values as a string.
-func (o *UlimitOpt) String() string {
- var out []string
- for _, v := range *o.values {
- out = append(out, v.String())
- }
-
- return fmt.Sprintf("%v", out)
-}
-
-// GetList returns a slice of pointers to Ulimits.
-func (o *UlimitOpt) GetList() []*units.Ulimit {
- var ulimits []*units.Ulimit
- for _, v := range *o.values {
- ulimits = append(ulimits, v)
- }
-
- return ulimits
-}
-
-// Type returns the option type
-func (o *UlimitOpt) Type() string {
- return "ulimit"
-}
-
-// NamedUlimitOpt defines a named map of Ulimits
-type NamedUlimitOpt struct {
- name string
- UlimitOpt
-}
-
-var _ NamedOption = &NamedUlimitOpt{}
-
-// NewNamedUlimitOpt creates a new NamedUlimitOpt
-func NewNamedUlimitOpt(name string, ref *map[string]*units.Ulimit) *NamedUlimitOpt {
- if ref == nil {
- ref = &map[string]*units.Ulimit{}
- }
- return &NamedUlimitOpt{
- name: name,
- UlimitOpt: *NewUlimitOpt(ref),
- }
-}
-
-// Name returns the option name
-func (o *NamedUlimitOpt) Name() string {
- return o.name
-}
diff --git a/vendor/github.com/docker/libnetwork/LICENSE b/vendor/github.com/docker/libnetwork/LICENSE
deleted file mode 100644
index e06d20818..000000000
--- a/vendor/github.com/docker/libnetwork/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/vendor/github.com/docker/libnetwork/ipamutils/utils.go b/vendor/github.com/docker/libnetwork/ipamutils/utils.go
deleted file mode 100644
index 3fd37cd88..000000000
--- a/vendor/github.com/docker/libnetwork/ipamutils/utils.go
+++ /dev/null
@@ -1,135 +0,0 @@
-// Package ipamutils provides utility functions for ipam management
-package ipamutils
-
-import (
- "fmt"
- "net"
- "sync"
-)
-
-var (
- // PredefinedLocalScopeDefaultNetworks contains a list of 31 IPv4 private networks with host size 16 and 12
- // (172.17-31.x.x/16, 192.168.x.x/20) which do not overlap with the networks in `PredefinedGlobalScopeDefaultNetworks`
- PredefinedLocalScopeDefaultNetworks []*net.IPNet
- // PredefinedGlobalScopeDefaultNetworks contains a list of 64K IPv4 private networks with host size 8
- // (10.x.x.x/24) which do not overlap with the networks in `PredefinedLocalScopeDefaultNetworks`
- PredefinedGlobalScopeDefaultNetworks []*net.IPNet
- mutex sync.Mutex
- localScopeDefaultNetworks = []*NetworkToSplit{{"172.17.0.0/16", 16}, {"172.18.0.0/16", 16}, {"172.19.0.0/16", 16},
- {"172.20.0.0/14", 16}, {"172.24.0.0/14", 16}, {"172.28.0.0/14", 16},
- {"192.168.0.0/16", 20}}
- globalScopeDefaultNetworks = []*NetworkToSplit{{"10.0.0.0/8", 24}}
-)
-
-// NetworkToSplit represent a network that has to be split in chunks with mask length Size.
-// Each subnet in the set is derived from the Base pool. Base is to be passed
-// in CIDR format.
-// Example: a Base "10.10.0.0/16 with Size 24 will define the set of 256
-// 10.10.[0-255].0/24 address pools
-type NetworkToSplit struct {
- Base string `json:"base"`
- Size int `json:"size"`
-}
-
-func init() {
- var err error
- if PredefinedGlobalScopeDefaultNetworks, err = splitNetworks(globalScopeDefaultNetworks); err != nil {
- //we are going to panic in case of error as we should never get into this state
- panic("InitAddressPools failed to initialize the global scope default address pool")
- }
-
- if PredefinedLocalScopeDefaultNetworks, err = splitNetworks(localScopeDefaultNetworks); err != nil {
- //we are going to panic in case of error as we should never get into this state
- panic("InitAddressPools failed to initialize the local scope default address pool")
- }
-}
-
-// configDefaultNetworks configures local as well global default pool based on input
-func configDefaultNetworks(defaultAddressPool []*NetworkToSplit, result *[]*net.IPNet) error {
- mutex.Lock()
- defer mutex.Unlock()
- defaultNetworks, err := splitNetworks(defaultAddressPool)
- if err != nil {
- return err
- }
- *result = defaultNetworks
- return nil
-}
-
-// GetGlobalScopeDefaultNetworks returns PredefinedGlobalScopeDefaultNetworks
-func GetGlobalScopeDefaultNetworks() []*net.IPNet {
- mutex.Lock()
- defer mutex.Unlock()
- return PredefinedGlobalScopeDefaultNetworks
-}
-
-// GetLocalScopeDefaultNetworks returns PredefinedLocalScopeDefaultNetworks
-func GetLocalScopeDefaultNetworks() []*net.IPNet {
- mutex.Lock()
- defer mutex.Unlock()
- return PredefinedLocalScopeDefaultNetworks
-}
-
-// ConfigGlobalScopeDefaultNetworks configures global default pool.
-// Ideally this will be called from SwarmKit as part of swarm init
-func ConfigGlobalScopeDefaultNetworks(defaultAddressPool []*NetworkToSplit) error {
- if defaultAddressPool == nil {
- defaultAddressPool = globalScopeDefaultNetworks
- }
- return configDefaultNetworks(defaultAddressPool, &PredefinedGlobalScopeDefaultNetworks)
-}
-
-// ConfigLocalScopeDefaultNetworks configures local default pool.
-// Ideally this will be called during libnetwork init
-func ConfigLocalScopeDefaultNetworks(defaultAddressPool []*NetworkToSplit) error {
- if defaultAddressPool == nil {
- return nil
- }
- return configDefaultNetworks(defaultAddressPool, &PredefinedLocalScopeDefaultNetworks)
-}
-
-// splitNetworks takes a slice of networks, split them accordingly and returns them
-func splitNetworks(list []*NetworkToSplit) ([]*net.IPNet, error) {
- localPools := make([]*net.IPNet, 0, len(list))
-
- for _, p := range list {
- _, b, err := net.ParseCIDR(p.Base)
- if err != nil {
- return nil, fmt.Errorf("invalid base pool %q: %v", p.Base, err)
- }
- ones, _ := b.Mask.Size()
- if p.Size <= 0 || p.Size < ones {
- return nil, fmt.Errorf("invalid pools size: %d", p.Size)
- }
- localPools = append(localPools, splitNetwork(p.Size, b)...)
- }
- return localPools, nil
-}
-
-func splitNetwork(size int, base *net.IPNet) []*net.IPNet {
- one, bits := base.Mask.Size()
- mask := net.CIDRMask(size, bits)
- n := 1 << uint(size-one)
- s := uint(bits - size)
- list := make([]*net.IPNet, 0, n)
-
- for i := 0; i < n; i++ {
- ip := copyIP(base.IP)
- addIntToIP(ip, uint(i<<s))
- list = append(list, &net.IPNet{IP: ip, Mask: mask})
- }
- return list
-}
-
-func copyIP(from net.IP) net.IP {
- ip := make([]byte, len(from))
- copy(ip, from)
- return ip
-}
-
-func addIntToIP(array net.IP, ordinal uint) {
- for i := len(array) - 1; i >= 0; i-- {
- array[i] |= (byte)(ordinal & 0xff)
- ordinal >>= 8
- }
-}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index db7e9b5bb..5aa5af553 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -371,7 +371,6 @@ github.com/docker/docker/api/types/versions
github.com/docker/docker/api/types/volume
github.com/docker/docker/client
github.com/docker/docker/errdefs
-github.com/docker/docker/opts
github.com/docker/docker/pkg/archive
github.com/docker/docker/pkg/fileutils
github.com/docker/docker/pkg/homedir
@@ -401,9 +400,6 @@ github.com/docker/go-plugins-helpers/volume
# github.com/docker/go-units v0.4.0
## explicit
github.com/docker/go-units
-# github.com/docker/libnetwork v0.8.0-dev.2.0.20190625141545-5a177b73e316
-## explicit
-github.com/docker/libnetwork/ipamutils
# github.com/felixge/httpsnoop v1.0.1
github.com/felixge/httpsnoop
# github.com/fsnotify/fsnotify v1.5.4