testutils

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package testutils contains utilities for testing traceroute code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMockICMPLayer

func CreateMockICMPLayer(typeCode layers.ICMPv4TypeCode) *layers.ICMPv4

CreateMockICMPLayer creates a mock ICMP layer for testing

func CreateMockICMPPacket

func CreateMockICMPPacket(ipLayer *layers.IPv4, icmpLayer *layers.ICMPv4, innerIP *layers.IPv4, innerTCP *layers.TCP, partialTCPHeader bool) []byte

CreateMockICMPPacket creates a mock ICMP packet for testing

func CreateMockIPv4Header

func CreateMockIPv4Header(srcIP, dstIP net.IP, protocol int) *ipv4.Header

CreateMockIPv4Header creates a mock IPv4 header for testing

func CreateMockIPv4Layer

func CreateMockIPv4Layer(srcIP, dstIP net.IP, protocol layers.IPProtocol) *layers.IPv4

CreateMockIPv4Layer creates a mock IPv4 layer for testing

func CreateMockTCPLayer

func CreateMockTCPLayer(srcPort uint16, dstPort uint16, seqNum uint32, ackNum uint32, syn bool, ack bool, rst bool) *layers.TCP

CreateMockTCPLayer creates a mock TCP layer for testing

func CreateMockTCPPacket

func CreateMockTCPPacket(ipHeader *ipv4.Header, tcpLayer *layers.TCP, includeHeader bool) (*layers.TCP, []byte)

CreateMockTCPPacket creates a mock TCP packet for testing

func StructFieldCount

func StructFieldCount(v interface{}) int

StructFieldCount returns the number of fields in a struct

Types

This section is empty.

Jump to

Keyboard shortcuts

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