From 047145b94ec3a29d339a6ec63f16fe58a86fdedb Mon Sep 17 00:00:00 2001 From: Ilya Gavrilov Date: Fri, 7 Nov 2025 17:54:05 +0100 Subject: [PATCH 1/2] Add Flow ID --- api.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api.go b/api.go index 6af53be..6c182f7 100644 --- a/api.go +++ b/api.go @@ -723,6 +723,7 @@ type OutputChannelItem struct { Capture *Capture Checksums []string MatcherKey string + FlowId []byte } type ReadProgress struct { @@ -787,6 +788,7 @@ func (e *Emitting) Emit(item *OutputChannelItem) { item.Stream = e.Stream.GetPcapId() item.Index = e.Stream.GetIndex() item.Tls = e.Stream.GetTls() + item.FlowId = e.Stream.GetFlowID() e.Stream.IncrementItemCount() e.OutputChannel <- item } @@ -894,6 +896,7 @@ type Entry struct { NetworkProps *protoCommon.NetworkProperties `json:"networkProps"` CaptureSource protoCommon.CaptureSource `json:"captureSource"` SubProtocol protoCommon.DissectedSubProtocol `json:"subProtocol"` + FlowId []byte `json:"flowId"` } func (e *Entry) BuildId() { @@ -1133,6 +1136,7 @@ type TcpStream interface { GetChecksums() []string GetNetworkProps() *protoCommon.NetworkProperties GetCaptureSource() protoCommon.CaptureSource + GetFlowID() []byte Lock() Unlock() } From 3e928f3662f74889984f483f5289927f2d02e93f Mon Sep 17 00:00:00 2001 From: Ilya Gavrilov Date: Wed, 12 Nov 2025 14:25:53 +0100 Subject: [PATCH 2/2] replace FlowId with uint64 --- api.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api.go b/api.go index 6c182f7..2a123f2 100644 --- a/api.go +++ b/api.go @@ -8,7 +8,6 @@ import ( "sync" "time" - "github.com/google/uuid" capture "github.com/kubeshark/api2/pkg/proto/capture/v1" protoCommon "github.com/kubeshark/api2/pkg/proto/common/v1" "github.com/kubeshark/gopacket" @@ -723,7 +722,7 @@ type OutputChannelItem struct { Capture *Capture Checksums []string MatcherKey string - FlowId []byte + FlowId uint64 } type ReadProgress struct { @@ -758,7 +757,7 @@ type Dissector interface { Dissect(b *bufio.Reader, reader TcpReader) (err error) Analyze(item *OutputChannelItem, resolvedSource *Resolution, resolvedDestination *Resolution) *Entry Summarize(entry *Entry) *BaseEntry - Summarize2(entry *Entry, id uuid.UUID) *capture.BaseEntry + Summarize2(entry *Entry, id uint64) *capture.BaseEntry Represent(request interface{}, response interface{}, event *Event, data interface{}) (representation *Representation) Macros() map[string]string NewResponseRequestMatcher() RequestResponseMatcher @@ -896,7 +895,7 @@ type Entry struct { NetworkProps *protoCommon.NetworkProperties `json:"networkProps"` CaptureSource protoCommon.CaptureSource `json:"captureSource"` SubProtocol protoCommon.DissectedSubProtocol `json:"subProtocol"` - FlowId []byte `json:"flowId"` + FlowId uint64 `json:"flowId"` } func (e *Entry) BuildId() { @@ -1136,7 +1135,7 @@ type TcpStream interface { GetChecksums() []string GetNetworkProps() *protoCommon.NetworkProperties GetCaptureSource() protoCommon.CaptureSource - GetFlowID() []byte + GetFlowID() uint64 Lock() Unlock() }