Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40d06dc

Browse files
author
liangwei
committed
ipvs support rs connection information
Signed-off-by: liangwei <[email protected]>
1 parent a79d368 commit 40d06dc

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

ipvs/ipvs.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ type SvcStats struct {
5353
// Destination defines an IPVS destination (real server) in its
5454
// entirety.
5555
type Destination struct {
56-
Address net.IP
57-
Port uint16
58-
Weight int
59-
ConnectionFlags uint32
60-
AddressFamily uint16
61-
UpperThreshold uint32
62-
LowerThreshold uint32
56+
Address net.IP
57+
Port uint16
58+
Weight int
59+
ConnectionFlags uint32
60+
AddressFamily uint16
61+
UpperThreshold uint32
62+
LowerThreshold uint32
63+
ActiveConnections int
64+
InactiveConnections int
6365
}
6466

6567
// Handle provides a namespace specific ipvs handle to program ipvs

ipvs/netlink.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
439439
d.LowerThreshold = native.Uint32(attr.Value)
440440
case ipvsDestAttrAddressFamily:
441441
d.AddressFamily = native.Uint16(attr.Value)
442+
case ipvsDestAttrActiveConnections:
443+
d.ActiveConnections = int(native.Uint16(attr.Value))
444+
case ipvsDestAttrInactiveConnections:
445+
d.InactiveConnections = int(native.Uint16(attr.Value))
442446
}
443447
}
444448
return &d, nil

0 commit comments

Comments
 (0)