diff options
Diffstat (limited to 'stream_factory.go')
-rw-r--r-- | stream_factory.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/stream_factory.go b/stream_factory.go new file mode 100644 index 0000000..e1d76a4 --- /dev/null +++ b/stream_factory.go @@ -0,0 +1,29 @@ +package main + +import ( + "github.com/google/gopacket" + "github.com/google/gopacket/tcpassembly" +) + +type BiDirectionalStreamFactory struct { + storage *Storage + serverIp string +} + +// httpStream will handle the actual decoding of http requests. +type uniDirectionalStream struct { + net, transport gopacket.Flow + r StreamHandler +} + +func (h *BiDirectionalStreamFactory) New(net, transport gopacket.Flow) tcpassembly.Stream { + hstream := &uniDirectionalStream{ + net: net, + transport: transport, + r: NewStreamHandler(), + } + // go hstream.run() // Important... we must guarantee that data from the tcpreader stream is read. + + // StreamHandler implements tcpassembly.Stream, so we can return a pointer to it. + return &hstream.r +} |