Documentation
¶
Index ¶
- func CheckARPTable(ip net.IP, iface *net.Interface) (net.HardwareAddr, error)
- func CreateARPRequest(srcMAC net.HardwareAddr, srcIP, dstIP net.IP) ([]byte, error)
- func Get(ip net.IP, iface *net.Interface, src net.IP) (net.HardwareAddr, error)
- func IsARPReplyFor(packet gopacket.Packet, targetIP net.IP) (net.HardwareAddr, bool)
- func RecvARPRequest(handle *pcap.Handle, arpChan chan net.HardwareAddr, ip net.IP, ...) error
- func SendARPRequest(handle *pcap.Handle, srcMAC net.HardwareAddr, srcIP, dstIP net.IP) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckARPTable ¶
CheckARPTable checks if IP is in the kernel ARP table for the provided interface and returns the corresponding MAC address if found. It supports Linux, Darwin (macOS) and FreeBSD platforms.
func CreateARPRequest ¶
CreateARPRequest creates an ARP request packet as bytes. This function is pure and easily testable.
func Get ¶
Get retrieves the MAC address for a given IP address. It first checks the kernel ARP table and if not found, sends an ARP request.
func IsARPReplyFor ¶
IsARPReplyFor checks if the given packet is an ARP reply for the target IP. This function is pure and easily testable.
func RecvARPRequest ¶
func RecvARPRequest(handle *pcap.Handle, arpChan chan net.HardwareAddr, ip net.IP, stop chan struct{}) error
RecvARPRequest listens for ARP requests on the provided handle and sends the MAC address to the channel if the sender IP matches the provided ip
func SendARPRequest ¶
SendARPRequest sends an ARP request to the network using the provided handle
Types ¶
This section is empty.