mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-30 16:23:27 +00:00
Learn isClient
from the TCP stream
This commit is contained in:
parent
fc7d219941
commit
10b08317f7
@ -91,7 +91,7 @@ func (h *tcpReader) Read(p []byte) (int, error) {
|
||||
return l, nil
|
||||
}
|
||||
|
||||
func (h *tcpReader) run(wg *sync.WaitGroup) {
|
||||
func (h *tcpReader) run(wg *sync.WaitGroup, isClient bool) {
|
||||
defer wg.Done()
|
||||
|
||||
data, err := io.ReadAll(h)
|
||||
@ -102,9 +102,7 @@ func (h *tcpReader) run(wg *sync.WaitGroup) {
|
||||
r := bytes.NewReader(data)
|
||||
|
||||
for _, extension := range extensions {
|
||||
for _, isClient := range []bool{true, false} {
|
||||
r.Reset(data)
|
||||
extension.Dissector.Dissect(bufio.NewReader(r), isClient, h.tcpID, h.Emitter)
|
||||
}
|
||||
r.Reset(data)
|
||||
extension.Dissector.Dissect(bufio.NewReader(r), isClient, h.tcpID, h.Emitter)
|
||||
}
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T
|
||||
}
|
||||
factory.wg.Add(2)
|
||||
// Start reading from channel stream.reader.bytes
|
||||
go stream.client.run(&factory.wg)
|
||||
go stream.server.run(&factory.wg)
|
||||
go stream.client.run(&factory.wg, true)
|
||||
go stream.server.run(&factory.wg, false)
|
||||
}
|
||||
return stream
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user