packet

package
v0.0.0-...-ab0a638 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: EUPL-1.2 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Creator

type Creator struct {
	PID        uint16
	SourceIP   netip.Addr
	SourceLink *net.Interface
	SourceMAC  net.HardwareAddr
	DestMAC    net.HardwareAddr
	PPPoE      struct {
		Interface *net.Interface
		SourceMAC net.HardwareAddr
		DestMAC   net.HardwareAddr
		SessionID uint16
		VLAN      uint16
	}
}

Creator contains the options for creating a packet.

func NewCreator

func NewCreator(options CreatorOpts) (Creator, error)

NewCreator returns an initialized Creator based on the given options.

func (Creator) NewPacket

func (c Creator) NewPacket(dst netip.Addr, seq int) Packet

func (Creator) SerializePacket

func (c Creator) SerializePacket(packet Packet, dst netip.Addr, seq int) int

type CreatorOpts

type CreatorOpts struct {
	SourceAddr string
	DestAddr   string
	PPPoE      struct {
		Interface string
		NextHop   string
		SessionID int
		VLAN      int
	}
}

CreatorOpts contains the options for generating packets.

type Packet

type Packet []byte

Packet represents a raw ICMP packet. It includes Ethernet, VLAN and PPPoE frames if required.

Jump to

Keyboard shortcuts

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