Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ARP ¶
type ARP struct { HType ARPType PType EtherType HLen byte PLen byte Oper ARPOpCode SourceHW net.HardwareAddr SourceIP netip.Addr DestHW net.HardwareAddr DestIP netip.Addr PacketBytes }
func (ARP) GetContents ¶
func (ARP) GetPayload ¶
type Ethernet ¶
type Ethernet struct { PacketBytes Destination net.HardwareAddr Source net.HardwareAddr EthernetType EtherType }
func (Ethernet) GetContents ¶
func (Ethernet) GetPayload ¶
type IPv4 ¶
type IPv4 struct { IHL uint8 DSCP uint8 ECN uint8 TotalLen uint16 ID uint16 Flags uint8 FragOffset uint16 Hops uint8 Proto uint8 HeaderChecksum uint16 Source netip.Addr Destination netip.Addr // Todo: options PacketBytes }
func (IPv4) GetContents ¶
func (IPv4) GetPayload ¶
type Layer ¶
type Layer interface { // Type returns the layer type. Type() LayerType // GetContents() returns the entire layer contents in bytes. GetContents() []byte // GetPayload() returns the layer payload. That is Contents()[hdrSize:] GetPayload() []byte }
Layer contains a decoded layer instance, such as an Ethernet frame, or an IP packet.
type LayerType ¶
type LayerType uint8
LayerType is a non-standard enumeration of layer instances such as Ethernet, or IPv4.
type Packet ¶
type Packet struct { // Link contains the link-layer representation of the packet. Link *Ethernet // Network contains the network-layer representation of the packet. Network Layer }
Packet represents a raw packet flowing through the network.
func PacketFromEthernet ¶
PacketFromEthernet creates a new packet from an ethernet descriptor.
type PacketBytes ¶
type PacketBytes struct { // Contents contains the entire packet's bytes. Contents []byte // Payload contains the packet's payload. That is, the contents minus the // packet header. Payload []byte }
PacketBytes ensures a coherent naming scheme for packets' internal byte slice references.
Click to show internal directories.
Click to hide internal directories.