pcap

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TODO: packet capture timeouts are tuned using the packet capture tests on a
	// particular developer's machine. We should implement some autotuning logic
	// based on specific machine that the broker is running on.
	// https://app.clubhouse.io/akita-software/story/521
	PktCaptureWaitFlag = flag.Duration("packet_capture_wait_duration", 30*time.Millisecond, "Amount of time to wait after API calls complete before stopping packet capture. This has a direct impact on our API test throughput.")
)

Functions

func CreatePacket

func CreatePacket(src, dst net.IP, srcPort, dstPort int, payload []byte) gopacket.Packet

func CreatePacketWithSeq

func CreatePacketWithSeq(src, dst net.IP, srcPort, dstPort int, payload []byte, seq uint32) gopacket.Packet

func CreateTCPSYN

func CreateTCPSYN(src, dst net.IP, srcPort, dstPort int, seq uint32) gopacket.Packet

func CreateTCPSYNAndACK

func CreateTCPSYNAndACK(src, dst net.IP, srcPort, dstPort int, seq uint32) gopacket.Packet

func CreateUDPPacket

func CreateUDPPacket(src, dst net.IP, srcPort, dstPort int, payload []byte) gopacket.Packet

Types

type NetworkTrafficObserver added in v0.13.0

type NetworkTrafficObserver func(gopacket.Packet)

NetworkTrafficObserver is the callback function type for observing packets as they come in to a NetworkTrafficParser.

type NetworkTrafficParser

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

func NewNetworkTrafficParser

func NewNetworkTrafficParser() *NetworkTrafficParser

func (*NetworkTrafficParser) InstallObserver added in v0.13.0

func (p *NetworkTrafficParser) InstallObserver(observer NetworkTrafficObserver)

Replace the current per-packet callback. Should be called before starting ParseFromInterface.

func (*NetworkTrafficParser) ParseFromInterface

func (p *NetworkTrafficParser) ParseFromInterface(interfaceName, bpfFilter string, signalClose <-chan struct{}, fs ...akinet.TCPParserFactory) (<-chan akinet.ParsedNetworkTraffic, error)

Parses network traffic from an interface. This function will attempt to parse the traffic with the highest level of protocol details as possible. For instance, it will try to piece together HTTP request and response pairs. The order of parsers matters: earlier parsers will get tried first. Once a parser has been accepted, no other parser will be used.

Jump to

Keyboard shortcuts

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