From 4e6974ea8fd681450a555794e3fd6385d8a48c13 Mon Sep 17 00:00:00 2001 From: kwanhur Date: Wed, 18 Mar 2020 12:42:48 +0800 Subject: [PATCH] Feature: support destination persistent connections attribute Signed-off-by: kwanhur --- ipvs.go | 21 +++++++++++---------- netlink.go | 2 ++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ipvs.go b/ipvs.go index 61b6f0a..f3be682 100644 --- a/ipvs.go +++ b/ipvs.go @@ -52,16 +52,17 @@ type SvcStats struct { // Destination defines an IPVS destination (real server) in its // entirety. type Destination struct { - Address net.IP - Port uint16 - Weight int - ConnectionFlags uint32 - AddressFamily uint16 - UpperThreshold uint32 - LowerThreshold uint32 - ActiveConnections int - InactiveConnections int - Stats DstStats + Address net.IP + Port uint16 + Weight int + ConnectionFlags uint32 + AddressFamily uint16 + UpperThreshold uint32 + LowerThreshold uint32 + ActiveConnections int + InactiveConnections int + PersistentConnections int + Stats DstStats } // DstStats defines IPVS destination (real server) statistics diff --git a/netlink.go b/netlink.go index 1a822da..86c69fe 100644 --- a/netlink.go +++ b/netlink.go @@ -449,6 +449,8 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error) d.ActiveConnections = int(native.Uint16(attr.Value)) case ipvsDestAttrInactiveConnections: d.InactiveConnections = int(native.Uint16(attr.Value)) + case ipvsDestAttrPersistentConnections: + d.PersistentConnections = int(native.Uint16(attr.Value)) case ipvsSvcAttrStats: stats, err := assembleStats(attr.Value) if err != nil {