network

package
v0.0.0-...-c97f47a Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Provides utility functions for sending and receiving packets over the network. Basically, it hides some of the complexity of using the capture and layers packages together.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextHopMAC

func NextHopMAC(c capture.Handle, t time.Duration, r *routing.Route, addr net.IP) (net.HardwareAddr, error)

Determine the next hop's MAX address to reach the given IP address and route by doing an ARP resolution.

func Recv

func Recv(c capture.Handle) (packet.Packet, error)

Capture a single packet from the given capture handle, unpack it and return it. This will block until a packet is received.

func Send

func Send(c capture.Handle, pkts ...packet.Packet) error

Pack packets into their binary form and inject them in the given capture handle.. This will stack the packets before encoding them and also calculate the checksums.

func SendRecv

func SendRecv(c capture.Handle, t time.Duration, pkts ...packet.Packet) (packet.Packet, error)

Like Send() and Recv() combined. This only returns a suitable answer for the sent packets. If t is not zero, this will return if not answer is received before t expires.

Types

This section is empty.

Jump to

Keyboard shortcuts

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