Documentation
¶
Index ¶
Constants ¶
View Source
const (
LinkTypeEthernet uint32 = 1
)
Common link-layer (DLT) identifiers used in pcap global headers. The values match the tcpdump/libpcap definitions.
Variables ¶
View Source
var ( // ErrHeaderAlreadyWritten indicates the global header has already been // emitted for this writer instance. ErrHeaderAlreadyWritten = errors.New("pcap: file header already written") // ErrHeaderNotWritten indicates a packet was written before the global header. ErrHeaderNotWritten = errors.New("pcap: file header not written") )
Functions ¶
This section is empty.
Types ¶
type CaptureInfo ¶
CaptureInfo describes metadata associated with a captured packet. Timestamp uses microsecond resolution when serialized into the pcap record.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer emits classic libpcap-formatted streams.
func NewWriter ¶
NewWriter wraps the supplied io.Writer. The caller must invoke WriteFileHeader once before any packets are written.
func (*Writer) WriteFileHeader ¶
WriteFileHeader writes the 24-byte global pcap header. It must be called exactly once per Writer instance before WritePacket is used.
func (*Writer) WritePacket ¶
func (w *Writer) WritePacket(ci CaptureInfo, data []byte) error
WritePacket appends a captured packet record to the stream.
Click to show internal directories.
Click to hide internal directories.