Skip to content

Commit

Permalink
Added comment about why we are sorting IP address for generating kafk…
Browse files Browse the repository at this point in the history
…a key
  • Loading branch information
OlivierCazade committed Apr 6, 2023
1 parent eb3f171 commit b6ca6ad
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/exporter/kafka_proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func (kp *KafkaProto) ExportFlows(input <-chan []*flow.Record) {
}

func getFlowKey(record *flow.Record) []byte {
// We are sorting IP address so flows from on ip to a second IP get the same key whatever the direction is
for k := range record.Id.SrcIp {
if record.Id.SrcIp[k] < record.Id.DstIp[k] {
return append(record.Id.SrcIp[:], record.Id.DstIp[:]...)
Expand Down

0 comments on commit b6ca6ad

Please sign in to comment.