mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-05 23:46:57 +08:00
move from Godeps to vndr
This uses the standard go vendor location instead of old Godeps location. Also remove usage of symlink GOPATH. Since our README mentions that you should build it inside GOPATH, i think its a reasonable to assume that you dont need to create a tmp GOPATH. Signed-off-by: Daniel Dao <dqminh89@gmail.com>
This commit is contained in:

committed by
Daniel Dao

parent
bd2f9c52cd
commit
993cbf9db0
43
vendor/github.com/vishvananda/netlink/addr.go
generated
vendored
Normal file
43
vendor/github.com/vishvananda/netlink/addr.go
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
package netlink
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Addr represents an IP address from netlink. Netlink ip addresses
|
||||
// include a mask, so it stores the address as a net.IPNet.
|
||||
type Addr struct {
|
||||
*net.IPNet
|
||||
Label string
|
||||
}
|
||||
|
||||
// String returns $ip/$netmask $label
|
||||
func (a Addr) String() string {
|
||||
return fmt.Sprintf("%s %s", a.IPNet, a.Label)
|
||||
}
|
||||
|
||||
// ParseAddr parses the string representation of an address in the
|
||||
// form $ip/$netmask $label. The label portion is optional
|
||||
func ParseAddr(s string) (*Addr, error) {
|
||||
label := ""
|
||||
parts := strings.Split(s, " ")
|
||||
if len(parts) > 1 {
|
||||
s = parts[0]
|
||||
label = parts[1]
|
||||
}
|
||||
m, err := ParseIPNet(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Addr{IPNet: m, Label: label}, nil
|
||||
}
|
||||
|
||||
// Equal returns true if both Addrs have the same net.IPNet value.
|
||||
func (a Addr) Equal(x Addr) bool {
|
||||
sizea, _ := a.Mask.Size()
|
||||
sizeb, _ := x.Mask.Size()
|
||||
// ignore label for comparison
|
||||
return a.IP.Equal(x.IP) && sizea == sizeb
|
||||
}
|
Reference in New Issue
Block a user