nettest

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2025 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyPackets

func CopyPackets(ctx context.Context, dst, src *Stack) error

CopyPackets copies packets from one stack to another until the context is canceled.

func SplicePackets

func SplicePackets(ctx context.Context, a, b *Stack) error

SplicePackets splices packets from one stack to another until the context is canceled.

Types

type Stack

type Stack struct {
	*stack.Stack
	NICID tcpip.NICID
	// contains filtered or unexported fields
}

func NewStack

func NewStack(addr netip.Addr, pcapPath string) (*Stack, error)

NewStack creates a new network stack with a single NIC and address. If pcapPath is not empty, packets will be written to the specified file.

func (*Stack) Close

func (s *Stack) Close()

func (*Stack) ReadPacket

func (s *Stack) ReadPacket(ctx context.Context) ([]byte, error)

func (*Stack) WritePacket

func (s *Stack) WritePacket(packet []byte) (int, error)

Jump to

Keyboard shortcuts

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