Add kernel conntrack counters (#3434)

This commit is contained in:
Viktor Liu
2025-03-04 16:46:03 +01:00
committed by GitHub
parent 8c81a823fa
commit acf172b52c
9 changed files with 545 additions and 360 deletions

View File

@@ -57,7 +57,7 @@ func (m *Manager) Update(update *nftypes.FlowConfig) error {
if update.Enabled {
if m.conntrack != nil {
if err := m.conntrack.Start(); err != nil {
if err := m.conntrack.Start(update.Counters); err != nil {
return fmt.Errorf("start conntrack: %w", err)
}
}
@@ -157,6 +157,10 @@ func toProtoEvent(publicKey []byte, event *nftypes.Event) *proto.FlowEvent {
Protocol: uint32(event.Protocol),
SourceIp: event.SourceIP.AsSlice(),
DestIp: event.DestIP.AsSlice(),
RxPackets: event.RxPackets,
TxPackets: event.TxPackets,
RxBytes: event.RxBytes,
TxBytes: event.TxBytes,
},
}
if event.Protocol == nftypes.ICMP {