libnetwork ipvs godeps

This commit is contained in:
m1093782566
2017-07-31 21:38:37 +08:00
parent 4457e43e7b
commit dcefbaefec
71 changed files with 10700 additions and 644 deletions

View File

@@ -10,12 +10,18 @@ import (
// include a mask, so it stores the address as a net.IPNet.
type Addr struct {
*net.IPNet
Label string
Label string
Flags int
Scope int
Peer *net.IPNet
Broadcast net.IP
PreferedLft int
ValidLft int
}
// String returns $ip/$netmask $label
func (a Addr) String() string {
return fmt.Sprintf("%s %s", a.IPNet, a.Label)
return strings.TrimSpace(fmt.Sprintf("%s %s", a.IPNet, a.Label))
}
// ParseAddr parses the string representation of an address in the
@@ -41,3 +47,10 @@ func (a Addr) Equal(x Addr) bool {
// ignore label for comparison
return a.IP.Equal(x.IP) && sizea == sizeb
}
func (a Addr) PeerEqual(x Addr) bool {
sizea, _ := a.Peer.Mask.Size()
sizeb, _ := x.Peer.Mask.Size()
// ignore label for comparison
return a.Peer.IP.Equal(x.Peer.IP) && sizea == sizeb
}