Documentation
¶
Overview ¶
Package pcapfile loads an Ethernet capture into a form the transmit loop can replay without allocating.
It uses gopacket's pure-Go pcapgo reader, so Wireblast has no libpcap or cgo dependency and a static binary works anywhere.
The whole file is read and validated before the dataplane starts. A broken or unsupported capture should cost you an error message, never a bounced link and a half-started run.
Index ¶
- Constants
- type File
- func (f *File) Bytes() int
- func (f *File) Describe() string
- func (f *File) Frame(i int) ([]byte, time.Duration)
- func (f *File) Len() int
- func (f *File) MaxLen() int
- func (f *File) MeanLen() int
- func (f *File) MinLen() int
- func (f *File) Span() time.Duration
- func (f *File) Truncated() int
- func (f *File) Warnings() []string
- type Limits
Constants ¶
const ( // MinFrame is the smallest thing that can be an Ethernet frame: two MAC // addresses and an EtherType. MinFrame = 14 // MaxFrame is the largest frame that can be transmitted. A UMEM frame is // at most a page, so anything above that is chained across several; this // stays comfortably inside how many frames one packet may span, and // preflight rejects a capture that does not. MaxFrame = 16384 // DefaultMaxBytes is the memory budget a capture may occupy when the // caller does not choose one. The whole capture is held in RAM (which this // runs as root on), so an unbounded load could OOM the host before the NIC // is ever touched; anyone with more memory can raise the budget with // --pcap-memory. DefaultMaxBytes = 1 << 30 // 1 GiB )
Limits on what will be loaded.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is a loaded capture, ready to replay.
Frames live in one contiguous byte slice with an index alongside, so replay is a slice expression and a copy — no per-packet allocation, and the frames stay adjacent in memory for the cache's benefit.
func (*File) Frame ¶
Frame returns the i-th frame and the gap the capture recorded before it. The returned slice aliases the backing store and must not be modified.