Packet Capturing and Injection

Packet capturing is the process of monitoring the raw traffic going through a network. This applies to wired Ethernet and wireless network devices. The tcpdump and libpcap packages are the standard when it comes to packet capturing. They were written in the 1980s and are still being used today. The gopacket package not only wraps the C libraries but also adds layers of Go abstraction to make it more idiomatic to Go and practical to use.

The pcap library allows you to gather information about network devices, read packets off the wire, store traffic in a .pcap file, filter traffic based on a number of criteria, or forge custom packets and send them through the network device. For the pcap library, filtering is ...

Get Security with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.