mirror of
https://github.com/apple/swift-nio-extras
synced 2026-11-25 04:47:50 +00:00
Motivation: Capturing all packets is expensive. Recording to a ring buffer and then outputting on a triggering event allows this cost to be reduced. Modifications: Add a new handler - NIOPCAPRingCaptureHandler. This derives from the existing NIOWritePCAPHandler and generates PCAP recordings. A ring buffer contained in this handler stores the captured packets until RecordPreviousPackets is received as a user message at which point they are flushed to the sink. Result: There is a new handler capable of outputting packet captured data only in the build up to a known event. Co-authored-by: Cory Benfield <lukasa@apple.com> Co-authored-by: George Barnett <gbrntt@gmail.com>