layers

package
v0.0.0-...-96e3f98 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EthTypeArp  uint16 = 0x0806
	EthTypeIpv4 uint16 = 0x0800
	EthTypeIpv6 uint16 = 0x86dd
)
View Source
const (
	DstMacLength       = 6
	SrcMacLength       = 6
	ProtocolTypeLength = 2
	Etherlen           = DstMacLength + SrcMacLength + ProtocolTypeLength
)

Ether packet length.

View Source
const (
	DstMACAddrOffset = 0
	SrcMACAddrOffset = 6
	Protocoloffset   = 12
)
View Source
const (
	ICMPv4TimeStampLength = 8
	ICMPv4DataLength      = 48
)
View Source
const (
	SrcIPv4Length = 4
	DstIPv4Length = 4
)
View Source
const (
	IPv4offsetTotalLength = 2                           // IPv4offsetPayloadLength is IPv4 offset payload length.
	IPv4offsetSrc         = 12                          // IPv4offsetSrc is IPv4 offset src length.
	IPv4offsetDst         = IPv4offsetSrc + net.IPv4len // IPv4offsetDst is IPv4 offset dst length.
)

IPv4 offset length.

View Source
const (
	IPv6offsetPayloadLength = 4                           // IPv6offsetPayloadLength is IPv6 offset payload length.
	IPv6offsetSrc           = 8                           // IPv6offsetSrc is IPv6 offset src length.
	IPv6offsetDst           = IPv6offsetSrc + net.IPv6len // IPv6offsetDst is IPv6 offset dst length.
)

IPv6 offset length.

View Source
const (
	SrcUDPLength = 2
	DstUDPLength = 2
)
View Source
const (
	SrcUDPPortOffset = 20
	DstUDPPortOffset = 22
)
View Source
const (
	ICMPv4Dataoffset = 42
)

Variables

This section is empty.

Functions

func DebugICMPv4Message

func DebugICMPv4Message(b []byte)

func DebugICMPv4Packet

func DebugICMPv4Packet(b []byte)

func DebugIPv4Packet

func DebugIPv4Packet(b []byte)

func DebugUDPMessage

func DebugUDPMessage(b []byte)

func UnmarshalEtherPacket

func UnmarshalEtherPacket(b []byte)

func UnmarshalICMPv4Packet

func UnmarshalICMPv4Packet(b []byte)

func UnmarshalIPv4Packet

func UnmarshalIPv4Packet(b []byte)

func UnmarshalUDPPacket

func UnmarshalUDPPacket(b []byte)

Types

type EtherHeader

type EtherHeader struct {
	DstMacAddr net.HardwareAddr
	SrcMacAddr net.HardwareAddr
	ProtoType  uint16
}

Jump to

Keyboard shortcuts

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