vendor: Update vishvanana/netlink dependency
This commit is contained in:
152
vendor/github.com/vishvananda/netlink/link.go
generated
vendored
152
vendor/github.com/vishvananda/netlink/link.go
generated
vendored
@ -35,6 +35,41 @@ type LinkAttrs struct {
|
||||
Promisc int
|
||||
Xdp *LinkXdp
|
||||
EncapType string
|
||||
Protinfo *Protinfo
|
||||
OperState LinkOperState
|
||||
}
|
||||
|
||||
// LinkOperState represents the values of the IFLA_OPERSTATE link
|
||||
// attribute, which contains the RFC2863 state of the interface.
|
||||
type LinkOperState uint8
|
||||
|
||||
const (
|
||||
OperUnknown = iota // Status can't be determined.
|
||||
OperNotPresent // Some component is missing.
|
||||
OperDown // Down.
|
||||
OperLowerLayerDown // Down due to state of lower layer.
|
||||
OperTesting // In some test mode.
|
||||
OperDormant // Not up but pending an external event.
|
||||
OperUp // Up, ready to send packets.
|
||||
)
|
||||
|
||||
func (s LinkOperState) String() string {
|
||||
switch s {
|
||||
case OperNotPresent:
|
||||
return "not-present"
|
||||
case OperDown:
|
||||
return "down"
|
||||
case OperLowerLayerDown:
|
||||
return "lower-layer-down"
|
||||
case OperTesting:
|
||||
return "testing"
|
||||
case OperDormant:
|
||||
return "dormant"
|
||||
case OperUp:
|
||||
return "up"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
// NewLinkAttrs returns LinkAttrs structure filled with default values
|
||||
@ -44,10 +79,12 @@ func NewLinkAttrs() LinkAttrs {
|
||||
}
|
||||
}
|
||||
|
||||
type LinkStatistics LinkStatistics64
|
||||
|
||||
/*
|
||||
Ref: struct rtnl_link_stats {...}
|
||||
*/
|
||||
type LinkStatistics struct {
|
||||
type LinkStatistics32 struct {
|
||||
RxPackets uint32
|
||||
TxPackets uint32
|
||||
RxBytes uint32
|
||||
@ -73,6 +110,63 @@ type LinkStatistics struct {
|
||||
TxCompressed uint32
|
||||
}
|
||||
|
||||
func (s32 LinkStatistics32) to64() *LinkStatistics64 {
|
||||
return &LinkStatistics64{
|
||||
RxPackets: uint64(s32.RxPackets),
|
||||
TxPackets: uint64(s32.TxPackets),
|
||||
RxBytes: uint64(s32.RxBytes),
|
||||
TxBytes: uint64(s32.TxBytes),
|
||||
RxErrors: uint64(s32.RxErrors),
|
||||
TxErrors: uint64(s32.TxErrors),
|
||||
RxDropped: uint64(s32.RxDropped),
|
||||
TxDropped: uint64(s32.TxDropped),
|
||||
Multicast: uint64(s32.Multicast),
|
||||
Collisions: uint64(s32.Collisions),
|
||||
RxLengthErrors: uint64(s32.RxLengthErrors),
|
||||
RxOverErrors: uint64(s32.RxOverErrors),
|
||||
RxCrcErrors: uint64(s32.RxCrcErrors),
|
||||
RxFrameErrors: uint64(s32.RxFrameErrors),
|
||||
RxFifoErrors: uint64(s32.RxFifoErrors),
|
||||
RxMissedErrors: uint64(s32.RxMissedErrors),
|
||||
TxAbortedErrors: uint64(s32.TxAbortedErrors),
|
||||
TxCarrierErrors: uint64(s32.TxCarrierErrors),
|
||||
TxFifoErrors: uint64(s32.TxFifoErrors),
|
||||
TxHeartbeatErrors: uint64(s32.TxHeartbeatErrors),
|
||||
TxWindowErrors: uint64(s32.TxWindowErrors),
|
||||
RxCompressed: uint64(s32.RxCompressed),
|
||||
TxCompressed: uint64(s32.TxCompressed),
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Ref: struct rtnl_link_stats64 {...}
|
||||
*/
|
||||
type LinkStatistics64 struct {
|
||||
RxPackets uint64
|
||||
TxPackets uint64
|
||||
RxBytes uint64
|
||||
TxBytes uint64
|
||||
RxErrors uint64
|
||||
TxErrors uint64
|
||||
RxDropped uint64
|
||||
TxDropped uint64
|
||||
Multicast uint64
|
||||
Collisions uint64
|
||||
RxLengthErrors uint64
|
||||
RxOverErrors uint64
|
||||
RxCrcErrors uint64
|
||||
RxFrameErrors uint64
|
||||
RxFifoErrors uint64
|
||||
RxMissedErrors uint64
|
||||
TxAbortedErrors uint64
|
||||
TxCarrierErrors uint64
|
||||
TxFifoErrors uint64
|
||||
TxHeartbeatErrors uint64
|
||||
TxWindowErrors uint64
|
||||
RxCompressed uint64
|
||||
TxCompressed uint64
|
||||
}
|
||||
|
||||
type LinkXdp struct {
|
||||
Fd int
|
||||
Attached bool
|
||||
@ -301,31 +395,31 @@ func StringToBondMode(s string) BondMode {
|
||||
|
||||
// Possible BondMode
|
||||
const (
|
||||
BOND_MODE_802_3AD BondMode = iota
|
||||
BOND_MODE_BALANCE_RR
|
||||
BOND_MODE_BALANCE_RR BondMode = iota
|
||||
BOND_MODE_ACTIVE_BACKUP
|
||||
BOND_MODE_BALANCE_XOR
|
||||
BOND_MODE_BROADCAST
|
||||
BOND_MODE_802_3AD
|
||||
BOND_MODE_BALANCE_TLB
|
||||
BOND_MODE_BALANCE_ALB
|
||||
BOND_MODE_UNKNOWN
|
||||
)
|
||||
|
||||
var bondModeToString = map[BondMode]string{
|
||||
BOND_MODE_802_3AD: "802.3ad",
|
||||
BOND_MODE_BALANCE_RR: "balance-rr",
|
||||
BOND_MODE_ACTIVE_BACKUP: "active-backup",
|
||||
BOND_MODE_BALANCE_XOR: "balance-xor",
|
||||
BOND_MODE_BROADCAST: "broadcast",
|
||||
BOND_MODE_802_3AD: "802.3ad",
|
||||
BOND_MODE_BALANCE_TLB: "balance-tlb",
|
||||
BOND_MODE_BALANCE_ALB: "balance-alb",
|
||||
}
|
||||
var StringToBondModeMap = map[string]BondMode{
|
||||
"802.3ad": BOND_MODE_802_3AD,
|
||||
"balance-rr": BOND_MODE_BALANCE_RR,
|
||||
"active-backup": BOND_MODE_ACTIVE_BACKUP,
|
||||
"balance-xor": BOND_MODE_BALANCE_XOR,
|
||||
"broadcast": BOND_MODE_BROADCAST,
|
||||
"802.3ad": BOND_MODE_802_3AD,
|
||||
"balance-tlb": BOND_MODE_BALANCE_TLB,
|
||||
"balance-alb": BOND_MODE_BALANCE_ALB,
|
||||
}
|
||||
@ -589,6 +683,54 @@ func (gretap *Gretap) Type() string {
|
||||
return "gretap"
|
||||
}
|
||||
|
||||
type Iptun struct {
|
||||
LinkAttrs
|
||||
Ttl uint8
|
||||
Tos uint8
|
||||
PMtuDisc uint8
|
||||
Link uint32
|
||||
Local net.IP
|
||||
Remote net.IP
|
||||
}
|
||||
|
||||
func (iptun *Iptun) Attrs() *LinkAttrs {
|
||||
return &iptun.LinkAttrs
|
||||
}
|
||||
|
||||
func (iptun *Iptun) Type() string {
|
||||
return "ipip"
|
||||
}
|
||||
|
||||
type Vti struct {
|
||||
LinkAttrs
|
||||
IKey uint32
|
||||
OKey uint32
|
||||
Link uint32
|
||||
Local net.IP
|
||||
Remote net.IP
|
||||
}
|
||||
|
||||
func (vti *Vti) Attrs() *LinkAttrs {
|
||||
return &vti.LinkAttrs
|
||||
}
|
||||
|
||||
func (iptun *Vti) Type() string {
|
||||
return "vti"
|
||||
}
|
||||
|
||||
type Vrf struct {
|
||||
LinkAttrs
|
||||
Table uint32
|
||||
}
|
||||
|
||||
func (vrf *Vrf) Attrs() *LinkAttrs {
|
||||
return &vrf.LinkAttrs
|
||||
}
|
||||
|
||||
func (vrf *Vrf) Type() string {
|
||||
return "vrf"
|
||||
}
|
||||
|
||||
// iproute2 supported devices;
|
||||
// vlan | veth | vcan | dummy | ifb | macvlan | macvtap |
|
||||
// bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan |
|
||||
|
Reference in New Issue
Block a user