Documentation ¶
Overview ¶
Provides packet capturing and injection on live network interfaces via libpcap.
Index ¶
- type Handle
- func (h *Handle) Activate() error
- func (h *Handle) ApplyFilter(filter *filter.Filter) error
- func (h *Handle) Capture() ([]byte, error)
- func (h *Handle) Close()
- func (h *Handle) Inject(buf []byte) error
- func (h *Handle) LinkType() packet.Type
- func (h *Handle) SetMTU(mtu int) error
- func (h *Handle) SetMonitorMode(monitor bool) error
- func (h *Handle) SetPromiscMode(promisc bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handle ¶
type Handle struct { Device string // contains filtered or unexported fields }
func Open ¶
Create a new capture handle from the given network interface. Noe that this may require root privileges.
func (*Handle) Activate ¶
Activate the packet source. Note that after calling this method it will not be possible to change the packet source configuration (MTU, promiscuous mode, monitor mode, ...)
func (*Handle) ApplyFilter ¶
Apply the given filter it to the packet source. Only packets that match this filter will be captured.
func (*Handle) Capture ¶
Capture a single packet from the packet source. This will block until a packet is received.
func (*Handle) LinkType ¶
Return the link type of the capture handle (that is, the type of packets that come out of the packet source).
func (*Handle) SetMonitorMode ¶
Enable/disable monitor mode. This is only relevant to RF-based packet sources (e.g. a WiFi or Bluetooth network interface)
func (*Handle) SetPromiscMode ¶
Enable/disable promiscuous mode.