Pārlūkot izejas kodu

vendor: github.com/moby/ipvs v1.1.0

full diff: https://github.com/moby/ipvs/compare/v1.0.2...v1.1.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit af6b5d55db70ebf093fc2d10b1bddf1adbd978bd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 gadi atpakaļ
vecāks
revīzija
c627132dc8

+ 1 - 1
vendor.mod

@@ -50,7 +50,7 @@ require (
 	github.com/miekg/dns v1.1.43
 	github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible
 	github.com/moby/buildkit v0.10.6
-	github.com/moby/ipvs v1.0.2
+	github.com/moby/ipvs v1.1.0
 	github.com/moby/locker v1.0.1
 	github.com/moby/patternmatcher v0.5.0
 	github.com/moby/pubsub v1.0.0

+ 2 - 2
vendor.sum

@@ -785,8 +785,8 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh
 github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
 github.com/moby/buildkit v0.10.6 h1:DJlEuLIgnu34HQKF4n9Eg6q2YqQVC0eOpMb4p2eRS2w=
 github.com/moby/buildkit v0.10.6/go.mod h1:tQuuyTWtOb9D+RE425cwOCUkX0/oZ+5iBZ+uWpWQ9bU=
-github.com/moby/ipvs v1.0.2 h1:NSbzuRTvfneftLU3VwPU5QuA6NZ0IUmqq9+VHcQxqHw=
-github.com/moby/ipvs v1.0.2/go.mod h1:2pngiyseZbIKXNv7hsKj3O9UEz30c53MT9005gt2hxQ=
+github.com/moby/ipvs v1.1.0 h1:ONN4pGaZQgAx+1Scz5RvWV4Q7Gb+mvfRh3NsPS+1XQQ=
+github.com/moby/ipvs v1.1.0/go.mod h1:4VJMWuf098bsUMmZEiD4Tjk/O7mOn3l1PTD3s4OoYAs=
 github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
 github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
 github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo=

+ 8 - 0
vendor/github.com/moby/ipvs/.golangci.yml

@@ -0,0 +1,8 @@
+linters:
+  disable-all: true
+  enable:
+    - gofmt
+    - govet
+    - ineffassign
+    - misspell
+    - revive

+ 4 - 4
vendor/github.com/moby/ipvs/LICENSE

@@ -1,4 +1,5 @@
-Apache License
+
+                                 Apache License
                            Version 2.0, January 2004
                         http://www.apache.org/licenses/
 
@@ -178,7 +179,7 @@ Apache License
    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 "{}"
+      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
@@ -186,7 +187,7 @@ Apache License
       same "printed page" as the copyright notice for easier
       identification within third-party archives.
 
-   Copyright {yyyy} {name of copyright owner}
+   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.
@@ -199,4 +200,3 @@ Apache License
    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.
-

+ 2 - 1
vendor/github.com/moby/ipvs/README.md

@@ -31,4 +31,5 @@ func main() {
 Want to hack on ipvs? [Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) apply.
 
 ## Copyright and license
-Code and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.
+
+Copyright 2015 Docker, inc. Code released under the [Apache 2.0 license](LICENSE).

+ 0 - 2
vendor/github.com/moby/ipvs/constants.go → vendor/github.com/moby/ipvs/constants_linux.go

@@ -1,5 +1,3 @@
-// +build linux
-
 package ipvs
 
 const (

+ 0 - 3
vendor/github.com/moby/ipvs/ipvs.go → vendor/github.com/moby/ipvs/ipvs_linux.go

@@ -1,5 +1,3 @@
-// +build linux
-
 package ipvs
 
 import (
@@ -181,7 +179,6 @@ func (i *Handle) GetDestinations(s *Service) ([]*Destination, error) {
 
 // GetService gets details of a specific IPVS services, useful in updating statisics etc.,
 func (i *Handle) GetService(s *Service) (*Service, error) {
-
 	res, err := i.doGetServicesCmd(s)
 	if err != nil {
 		return nil, err

+ 14 - 20
vendor/github.com/moby/ipvs/netlink.go → vendor/github.com/moby/ipvs/netlink_linux.go

@@ -1,5 +1,3 @@
-// +build linux
-
 package ipvs
 
 import (
@@ -124,8 +122,8 @@ func (i *Handle) doCmdwithResponse(s *Service, d *Destination, cmd uint8) ([][]b
 	req.Seq = atomic.AddUint32(&i.seq, 1)
 
 	if s == nil {
-		req.Flags |= syscall.NLM_F_DUMP                    //Flag to dump all messages
-		req.AddData(nl.NewRtAttr(ipvsCmdAttrService, nil)) //Add a dummy attribute
+		req.Flags |= syscall.NLM_F_DUMP                    // Flag to dump all messages
+		req.AddData(nl.NewRtAttr(ipvsCmdAttrService, nil)) // Add a dummy attribute
 	} else {
 		req.AddData(fillService(s))
 	}
@@ -134,7 +132,6 @@ func (i *Handle) doCmdwithResponse(s *Service, d *Destination, cmd uint8) ([][]b
 		if cmd == ipvsCmdGetDest {
 			req.Flags |= syscall.NLM_F_DUMP
 		}
-
 	} else {
 		req.AddData(fillDestination(d))
 	}
@@ -259,7 +256,6 @@ done:
 }
 
 func parseIP(ip []byte, family uint16) (net.IP, error) {
-
 	var resIP net.IP
 
 	switch family {
@@ -276,7 +272,6 @@ func parseIP(ip []byte, family uint16) (net.IP, error) {
 
 // parseStats
 func assembleStats(msg []byte) (SvcStats, error) {
-
 	var s SvcStats
 
 	attrs, err := nl.ParseRouteAttr(msg)
@@ -314,7 +309,6 @@ func assembleStats(msg []byte) (SvcStats, error) {
 
 // assembleService assembles a services back from a hain of netlink attributes
 func assembleService(attrs []syscall.NetlinkRouteAttr) (*Service, error) {
-
 	var s Service
 	var addressBytes []byte
 
@@ -366,10 +360,9 @@ func assembleService(attrs []syscall.NetlinkRouteAttr) (*Service, error) {
 
 // parseService given a ipvs netlink response this function will respond with a valid service entry, an error otherwise
 func (i *Handle) parseService(msg []byte) (*Service, error) {
-
 	var s *Service
 
-	//Remove General header for this message and parse the NetLink message
+	// Remove General header for this message and parse the NetLink message
 	hdr := deserializeGenlMsg(msg)
 	NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
 	if err != nil {
@@ -379,13 +372,13 @@ func (i *Handle) parseService(msg []byte) (*Service, error) {
 		return nil, fmt.Errorf("error no valid netlink message found while parsing service record")
 	}
 
-	//Now Parse and get IPVS related attributes messages packed in this message.
+	// Now Parse and get IPVS related attributes messages packed in this message.
 	ipvsAttrs, err := nl.ParseRouteAttr(NetLinkAttrs[0].Value)
 	if err != nil {
 		return nil, err
 	}
 
-	//Assemble all the IPVS related attribute messages and create a service record
+	// Assemble all the IPVS related attribute messages and create a service record
 	s, err = assembleService(ipvsAttrs)
 	if err != nil {
 		return nil, err
@@ -422,7 +415,6 @@ func (i *Handle) doCmdWithoutAttr(cmd uint8) ([][]byte, error) {
 }
 
 func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error) {
-
 	var d Destination
 	var addressBytes []byte
 
@@ -486,9 +478,12 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
 
 // getIPFamily parses the IP family based on raw data from netlink.
 // For AF_INET, netlink will set the first 4 bytes with trailing zeros
-//   10.0.0.1 -> [10 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0]
+//
+//	10.0.0.1 -> [10 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0]
+//
 // For AF_INET6, the full 16 byte array is used:
-//   2001:db8:3c4d:15::1a00 -> [32 1 13 184 60 77 0 21 0 0 0 0 0 0 26 0]
+//
+//	2001:db8:3c4d:15::1a00 -> [32 1 13 184 60 77 0 21 0 0 0 0 0 0 26 0]
 func getIPFamily(address []byte) (uint16, error) {
 	if len(address) == 4 {
 		return syscall.AF_INET, nil
@@ -519,7 +514,7 @@ func isZeros(b []byte) bool {
 func (i *Handle) parseDestination(msg []byte) (*Destination, error) {
 	var dst *Destination
 
-	//Remove General header for this message
+	// Remove General header for this message
 	hdr := deserializeGenlMsg(msg)
 	NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
 	if err != nil {
@@ -529,13 +524,13 @@ func (i *Handle) parseDestination(msg []byte) (*Destination, error) {
 		return nil, fmt.Errorf("error no valid netlink message found while parsing destination record")
 	}
 
-	//Now Parse and get IPVS related attributes messages packed in this message.
+	// Now Parse and get IPVS related attributes messages packed in this message.
 	ipvsAttrs, err := nl.ParseRouteAttr(NetLinkAttrs[0].Value)
 	if err != nil {
 		return nil, err
 	}
 
-	//Assemble netlink attributes and create a Destination record
+	// Assemble netlink attributes and create a Destination record
 	dst, err = assembleDestination(ipvsAttrs)
 	if err != nil {
 		return nil, err
@@ -546,7 +541,6 @@ func (i *Handle) parseDestination(msg []byte) (*Destination, error) {
 
 // doGetDestinationsCmd a wrapper function to be used by GetDestinations and GetDestination(d) apis
 func (i *Handle) doGetDestinationsCmd(s *Service, d *Destination) ([]*Destination, error) {
-
 	var res []*Destination
 
 	msgs, err := i.doCmdwithResponse(s, d, ipvsCmdGetDest)
@@ -568,7 +562,7 @@ func (i *Handle) doGetDestinationsCmd(s *Service, d *Destination) ([]*Destinatio
 func (i *Handle) parseConfig(msg []byte) (*Config, error) {
 	var c Config
 
-	//Remove General header for this message
+	// Remove General header for this message
 	hdr := deserializeGenlMsg(msg)
 	attrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
 	if err != nil {

+ 2 - 2
vendor/modules.txt

@@ -600,8 +600,8 @@ github.com/moby/buildkit/util/urlutil
 github.com/moby/buildkit/util/winlayers
 github.com/moby/buildkit/version
 github.com/moby/buildkit/worker
-# github.com/moby/ipvs v1.0.2
-## explicit; go 1.13
+# github.com/moby/ipvs v1.1.0
+## explicit; go 1.17
 github.com/moby/ipvs
 # github.com/moby/locker v1.0.1
 ## explicit; go 1.13