Versions in this module Expand all Collapse all v1 v1.3.0 Aug 24, 2024 v1.2.0 Nov 25, 2023 v1.1.1 Jun 27, 2023 v1.1.0 Mar 25, 2023 v1.0.0 Jan 20, 2023 v0 v0.1.0 Oct 6, 2022 Changes in this version + const BlockForever + const DirectionIn + const DirectionInOut + const DirectionOut + const ErrNotActive + const MaxBpfInstructions + var CannotSetRFMon = errors.New("Cannot set rfmon for this handle") + func DatalinkNameToVal(name string) int + func DatalinkValToDescription(dlt int) string + func DatalinkValToName(dlt int) string + func LoadWinPCAP() error — windows/amd64 + func Version() string + type BPF struct + func NewBPF(linkType layers.LinkType, captureLength int, expr string) (*BPF, error) + func (b *BPF) Matches(ci gopacket.CaptureInfo, data []byte) bool + func (b *BPF) String() string + type BPFInstruction struct + Code uint16 + Jf uint8 + Jt uint8 + K uint32 + func CompileBPFFilter(linkType layers.LinkType, captureLength int, expr string) ([]BPFInstruction, error) + type Datalink struct + Description string + Name string + type Direction uint8 + type Handle struct + func OpenLive(device string, snaplen int32, promisc bool, timeout time.Duration) (handle *Handle, _ error) + func OpenOffline(file string) (handle *Handle, err error) + func OpenOfflineFile(file *os.File) (handle *Handle, err error) + func (p *Handle) Close() + func (p *Handle) CompileBPFFilter(expr string) ([]BPFInstruction, error) + func (p *Handle) Error() error + func (p *Handle) LinkType() layers.LinkType + func (p *Handle) ListDataLinks() (datalinks []Datalink, err error) + func (p *Handle) NewBPF(expr string) (*BPF, error) + func (p *Handle) NewBPFInstructionFilter(bpfInstructions []BPFInstruction) (*BPF, error) + func (p *Handle) ReadPacketData() (data []byte, ci gopacket.CaptureInfo, err error) + func (p *Handle) Resolution() gopacket.TimestampResolution + func (p *Handle) SetBPFFilter(expr string) (err error) + func (p *Handle) SetBPFInstructionFilter(bpfInstructions []BPFInstruction) (err error) + func (p *Handle) SetDirection(direction Direction) error + func (p *Handle) SetLinkType(dlt layers.LinkType) error + func (p *Handle) SnapLen() int + func (p *Handle) Stats() (stat *Stats, err error) + func (p *Handle) WritePacketData(data []byte) (err error) + func (p *Handle) ZeroCopyReadPacketData() (data []byte, ci gopacket.CaptureInfo, err error) + type InactiveHandle struct + func NewInactiveHandle(device string) (*InactiveHandle, error) + func (p *InactiveHandle) Activate() (*Handle, error) + func (p *InactiveHandle) CleanUp() + func (p *InactiveHandle) Error() error + func (p *InactiveHandle) SetBufferSize(bufferSize int) error + func (p *InactiveHandle) SetImmediateMode(mode bool) error + func (p *InactiveHandle) SetPromisc(promisc bool) error + func (p *InactiveHandle) SetRFMon(monitor bool) error + func (p *InactiveHandle) SetSnapLen(snaplen int) error + func (p *InactiveHandle) SetTimeout(timeout time.Duration) error + func (p *InactiveHandle) SetTimestampSource(t TimestampSource) error + func (p *InactiveHandle) SupportedTimestamps() (out []TimestampSource) + type Interface struct + Addresses []InterfaceAddress + Description string + Flags uint32 + Name string + func FindAllDevs() (ifs []Interface, err error) + type InterfaceAddress struct + Broadaddr net.IP + IP net.IP + Netmask net.IPMask + P2P net.IP + type NextError int32 + const NextErrorNoMorePackets + const NextErrorNotActivated + const NextErrorOk + const NextErrorReadError + const NextErrorTimeoutExpired + func (n NextError) Error() string + type Stats struct + PacketsDropped int + PacketsIfDropped int + PacketsReceived int + type TimestampSource int + func TimestampSourceFromString(s string) (TimestampSource, error) + func (t TimestampSource) String() string