[20.10] vendor: github.com/moby/libnetwork dcdf8f176d1e13ad719e913e796fb698d846de98
Co-authored-by: Sebastiaan van Stijn <github@gone.nl> Signed-off-by: Scott Buckfelder <buckscot@amazon.com>
This commit is contained in:
parent
4ed81ac0e2
commit
72b9ba4f24
5 changed files with 14 additions and 78 deletions
|
@ -3,7 +3,7 @@
|
|||
# LIBNETWORK_COMMIT is used to build the docker-userland-proxy binary. When
|
||||
# updating the binary version, consider updating github.com/docker/libnetwork
|
||||
# in vendor.conf accordingly
|
||||
: "${LIBNETWORK_COMMIT:=0dde5c895075df6e3630e76f750a447cf63f4789}"
|
||||
: "${LIBNETWORK_COMMIT:=dcdf8f176d1e13ad719e913e796fb698d846de98}"
|
||||
|
||||
install_proxy() {
|
||||
case "$1" in
|
||||
|
@ -29,7 +29,7 @@ install_proxy_dynamic() {
|
|||
|
||||
_install_proxy() {
|
||||
echo "Install docker-proxy version $LIBNETWORK_COMMIT"
|
||||
git clone https://github.com/docker/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork"
|
||||
git clone https://github.com/moby/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork"
|
||||
cd "$GOPATH/src/github.com/docker/libnetwork"
|
||||
git checkout -q "$LIBNETWORK_COMMIT"
|
||||
go build ${BUILD_MODE} -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
|
||||
|
|
|
@ -48,7 +48,7 @@ github.com/grpc-ecosystem/go-grpc-middleware 3c51f7f332123e8be5a157c0802a
|
|||
# libnetwork
|
||||
|
||||
# When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy.installer accordingly
|
||||
github.com/docker/libnetwork 0dde5c895075df6e3630e76f750a447cf63f4789
|
||||
github.com/docker/libnetwork dcdf8f176d1e13ad719e913e796fb698d846de98
|
||||
github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f
|
||||
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
|
||||
github.com/armon/go-metrics f0300d1749da6fa982027e449ec0c7a145510c3c # v0.4.1
|
||||
|
|
9
vendor/github.com/docker/libnetwork/README.md
generated
vendored
9
vendor/github.com/docker/libnetwork/README.md
generated
vendored
|
@ -1,3 +1,12 @@
|
|||
> **Warning**
|
||||
> libnetwork was moved to https://github.com/moby/moby/tree/master/libnetwork
|
||||
>
|
||||
> libnetwork has been merged to the main repo of Moby since Docker 22.06.
|
||||
>
|
||||
> The old libnetwork repo (https://github.com/moby/libnetwork) now only accepts PR for Docker 20.10,
|
||||
> and will be archived after the EOL of Docker 20.10.
|
||||
|
||||
- - -
|
||||
# libnetwork - networking for containers
|
||||
|
||||
[![Circle CI](https://circleci.com/gh/docker/libnetwork/tree/master.svg?style=svg)](https://circleci.com/gh/docker/libnetwork/tree/master) [![Coverage Status](https://coveralls.io/repos/docker/libnetwork/badge.svg)](https://coveralls.io/r/docker/libnetwork) [![GoDoc](https://godoc.org/github.com/docker/libnetwork?status.svg)](https://godoc.org/github.com/docker/libnetwork) [![Go Report Card](https://goreportcard.com/badge/github.com/docker/libnetwork)](https://goreportcard.com/report/github.com/docker/libnetwork)
|
||||
|
|
19
vendor/github.com/docker/libnetwork/config/config.go
generated
vendored
19
vendor/github.com/docker/libnetwork/config/config.go
generated
vendored
|
@ -1,7 +1,6 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
|
@ -14,7 +13,6 @@ import (
|
|||
"github.com/docker/libnetwork/ipamutils"
|
||||
"github.com/docker/libnetwork/netlabel"
|
||||
"github.com/docker/libnetwork/osl"
|
||||
"github.com/docker/libnetwork/portallocator"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
@ -240,23 +238,6 @@ func OptionExperimental(exp bool) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// OptionDynamicPortRange function returns an option setter for service port allocation range
|
||||
func OptionDynamicPortRange(in string) Option {
|
||||
return func(c *Config) {
|
||||
start, end := 0, 0
|
||||
if len(in) > 0 {
|
||||
n, err := fmt.Sscanf(in, "%d-%d", &start, &end)
|
||||
if n != 2 || err != nil {
|
||||
logrus.Errorf("Failed to parse range string with err %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
if err := portallocator.Get().SetPortRange(start, end); err != nil {
|
||||
logrus.Errorf("Failed to set port range with err %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OptionNetworkControlPlaneMTU function returns an option setter for control plane MTU
|
||||
func OptionNetworkControlPlaneMTU(exp int) Option {
|
||||
return func(c *Config) {
|
||||
|
|
58
vendor/github.com/docker/libnetwork/portallocator/portallocator.go
generated
vendored
58
vendor/github.com/docker/libnetwork/portallocator/portallocator.go
generated
vendored
|
@ -3,7 +3,6 @@ package portallocator
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/sirupsen/logrus"
|
||||
"net"
|
||||
"sync"
|
||||
)
|
||||
|
@ -14,25 +13,9 @@ var (
|
|||
// defaultPortRangeEnd indicates the last port in port range
|
||||
// consistent with default /proc/sys/net/ipv4/ip_local_port_range
|
||||
// upper bound on linux
|
||||
defaultPortRangeEnd = 60999
|
||||
defaultPortRangeEnd = 65535
|
||||
)
|
||||
|
||||
func sanitizePortRange(start int, end int) (newStart, newEnd int, err error) {
|
||||
if start > defaultPortRangeEnd || end < defaultPortRangeStart || start > end {
|
||||
return 0, 0, fmt.Errorf("Request out allowed range [%v, %v]",
|
||||
defaultPortRangeStart, defaultPortRangeEnd)
|
||||
}
|
||||
err = nil
|
||||
newStart, newEnd = start, end
|
||||
if start < defaultPortRangeStart {
|
||||
newStart = defaultPortRangeStart
|
||||
}
|
||||
if end > defaultPortRangeEnd {
|
||||
newEnd = defaultPortRangeEnd
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ipMapping map[string]protoMap
|
||||
|
||||
var (
|
||||
|
@ -111,19 +94,11 @@ func Get() *PortAllocator {
|
|||
return instance
|
||||
}
|
||||
|
||||
func getDefaultPortRange() (int, int) {
|
||||
func newInstance() *PortAllocator {
|
||||
start, end, err := getDynamicPortRange()
|
||||
if err == nil {
|
||||
start, end, err = sanitizePortRange(start, end)
|
||||
}
|
||||
if err != nil {
|
||||
start, end = defaultPortRangeStart, defaultPortRangeEnd
|
||||
}
|
||||
return start, end
|
||||
}
|
||||
|
||||
func newInstance() *PortAllocator {
|
||||
start, end := getDefaultPortRange()
|
||||
return &PortAllocator{
|
||||
ipMap: ipMapping{},
|
||||
Begin: start,
|
||||
|
@ -197,35 +172,6 @@ func (p *PortAllocator) ReleasePort(ip net.IP, proto string, port int) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// SetPortRange sets dynamic port allocation range.
|
||||
// if both portBegin and portEnd are 0, the port range reverts to default
|
||||
// value. Otherwise they are sanitized against the default values to
|
||||
// ensure their validity.
|
||||
func (p *PortAllocator) SetPortRange(portBegin, portEnd int) error {
|
||||
// if begin and end is zero, revert to default values
|
||||
var begin, end int
|
||||
var err error
|
||||
if portBegin == 0 && portEnd == 0 {
|
||||
begin, end = getDefaultPortRange()
|
||||
|
||||
} else {
|
||||
begin, end, err = sanitizePortRange(portBegin, portEnd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
logrus.Debugf("Setting up port allocator to range %v-%v, current %v-%v",
|
||||
begin, end, p.Begin, p.End)
|
||||
p.mutex.Lock()
|
||||
defer p.mutex.Unlock()
|
||||
if p.Begin == begin && p.End == end {
|
||||
return nil
|
||||
}
|
||||
p.ipMap = ipMapping{}
|
||||
p.Begin, p.End = begin, end
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *PortAllocator) newPortMap() *portMap {
|
||||
defaultKey := getRangeKey(p.Begin, p.End)
|
||||
pm := &portMap{
|
||||
|
|
Loading…
Reference in a new issue