layer

package
v0.0.0-...-11e78ec Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ARPOpRequest = 1
)
View Source
const (
	ProtoUDP = 0x11
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ARP

type ARP struct {
	SenderMAC net.HardwareAddr
	SenderIP  net.IP
	TargetMAC net.HardwareAddr
	TargetIP  net.IP
	Opcode    uint8
}

func DecodeARP

func DecodeARP(b []byte) (*ARP, error)

func (ARP) Assemble

func (u ARP) Assemble() []byte

type IPv4

type IPv4 struct {
	Identification uint16
	Flags          uint16
	TTL            uint8
	Protocol       uint8
	Checksum       uint16
	Source         net.IP
	Destination    net.IP
	Data           []byte
}

func DecodeIPv4

func DecodeIPv4(b []byte) (*IPv4, error)

func (IPv4) Assemble

func (h IPv4) Assemble() []byte

type UDP

type UDP struct {
	SrcPort uint16
	DstPort uint16
	Data    []byte
}

func DecodeUDP

func DecodeUDP(b []byte) (*UDP, error)

func (UDP) Assemble

func (u UDP) Assemble() []byte

Jump to

Keyboard shortcuts

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