Add `Stats` to the `Destination`

This patch modifies the `Destination` struct so that the stats for
that destination are also reported.

Signed-off-by: Akshay <akshay.moghe@gmail.com>
This commit is contained in:
Akshay 2018-10-09 11:49:24 -07:00
parent 9b39ca36c7
commit e427c4ee2e
2 changed files with 7 additions and 0 deletions

View File

@ -62,6 +62,7 @@ type Destination struct {
LowerThreshold uint32
ActiveConnections int
InactiveConnections int
Stats SvcStats
}
// Handle provides a namespace specific ipvs handle to program ipvs

View File

@ -443,6 +443,12 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
d.ActiveConnections = int(native.Uint16(attr.Value))
case ipvsDestAttrInactiveConnections:
d.InactiveConnections = int(native.Uint16(attr.Value))
case ipvsSvcAttrStats:
stats, err := assembleStats(attr.Value)
if err != nil {
return nil, err
}
d.Stats = stats
}
}
return &d, nil