pcap

package
v0.0.0-...-75f38b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Traffic capture using libpcap

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetActiveInterfaces

func GetActiveInterfaces() ([]string, error)

Gets all the active network interfaces (only their names).

Types

type CaptureContext

type CaptureContext struct {
	// contains filtered or unexported fields
}

Capture the trafic using libpcap

func New

func New(device string) (*CaptureContext, error)

Creates a capture context using libpcap implementation and opens the device to capture. Ensure that the process has permission con capture traffic through the device.

func (*CaptureContext) Close

func (c *CaptureContext) Close()

Ends with the capture session

func (*CaptureContext) GetMAC

func (c *CaptureContext) GetMAC() net.HardwareAddr

Gets the MAC Address of the device being captured.

func (*CaptureContext) Packets

func (c *CaptureContext) Packets() chan *capture.Packet

Returns the packets channel where all the packets will be passed through.

func (*CaptureContext) StartCapturing

func (c *CaptureContext) StartCapturing()

Starts the capture session. Use Packets() to grab the packets channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL