Skip to content

Instantly share code, notes, and snippets.

@jeanqasaur
Last active April 27, 2021 04:39
Show Gist options
  • Save jeanqasaur/fedbd76ee8d5a7c36f6c80c11bcf4be4 to your computer and use it in GitHub Desktop.
Save jeanqasaur/fedbd76ee8d5a7c36f6c80c11bcf4be4 to your computer and use it in GitHub Desktop.
Example implementation of the Stream interface for packet processing
// tcpStream represents a pair of uni-directional tcpFlows. It
// implements reassembly.Stream interface to receive reassembled
// packets for BOTH flows, which it then directs to the correct
// tcpFlow.
type tcpStream struct {
clock clockWrapper // constant
bidiID akinet.TCPBidiID // constant
// Network layer flow.
netFlow gopacket.Flow
// flows is populated upon seeing the first packet.
flows map[reassembly.TCPFlowDirection]*tcpFlow
factorySelector akinet.TCPParserFactorySelector
outChan chan<- akinet.ParsedNetworkTraffic
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment