Documentation ¶
Overview ¶
Package saver provides the toold for saving a single flow's packets to disk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TCP ¶
type TCP struct { // Pchan is the channel down which pointers to packets will be sent. Pchan chan<- gopacket.Packet // UUIDChan is the channel that receives UUIDs with timestamps. UUIDchan chan<- UUIDEvent // contains filtered or unexported fields }
TCP provides two channels to allow packets to be saved. A well-buffered channel for packets and a channel to receive the UUID.
func StartNew ¶
func StartNew(ctx context.Context, anon anonymize.IPAnonymizer, dir string, uuidDelay, maxDuration time.Duration, id string, stream bool) *TCP
StartNew creates a new saver.TCP to save a single TCP flow and starts its goroutine. The goroutine can be stopped either by cancelling the passed-in context or by closing the Pchan channel. Closing Pchan is the preferred method, because it is an unambiguous signal that no more packets should be expected for that flow.
It is the caller's responsibility to close Pchan or cancel the context. uuidDelay must be smaller than maxDuration.