ipv4

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package ipv4 provides a thin, allocation-free view over raw IPv4 packets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanFrame

func ScanFrame(data []byte, atEof bool) (advance int, token []byte, err error)

ScanFrame implements bufio.SplitFunc to split a stream into IPv4 frames.

Types

type Frame

type Frame []byte

Frame is a raw IPv4 packet. Accessors read directly from the backing slice, so a Frame must be validated with DecodeFrame (or produced by MakeFrame or ScanFrame) before its variable-length fields are used.

func DecodeFrame

func DecodeFrame(data []byte) Frame

func MakeFrame

func MakeFrame(source, destination net.IP) Frame

func (Frame) Copy

func (self Frame) Copy() Frame

func (Frame) DSCP

func (self Frame) DSCP() byte

func (Frame) Destination

func (self Frame) Destination() net.IP

func (Frame) DestinationPort

func (self Frame) DestinationPort() uint16

func (Frame) ECN

func (self Frame) ECN() byte

func (Frame) Flags

func (self Frame) Flags() byte

func (Frame) FragmentOffset

func (self Frame) FragmentOffset() uint16

func (Frame) HeaderChecksum

func (self Frame) HeaderChecksum() uint16

func (Frame) IHL

func (self Frame) IHL() byte

func (Frame) Identification

func (self Frame) Identification() uint16

func (Frame) Options

func (self Frame) Options() []byte

func (Frame) Payload

func (self Frame) Payload() []byte

func (Frame) Protocol

func (self Frame) Protocol() byte

func (Frame) SetDestination

func (self Frame) SetDestination(ip net.IP)

func (Frame) SetIHL

func (self Frame) SetIHL(ihl byte)

func (Frame) SetSource

func (self Frame) SetSource(ip net.IP)

func (Frame) SetTotalLength

func (self Frame) SetTotalLength(totalLength uint16)

func (Frame) SetVersion

func (self Frame) SetVersion(version byte)

func (Frame) Source

func (self Frame) Source() net.IP

func (Frame) SourcePort

func (self Frame) SourcePort() uint16

func (Frame) TTL

func (self Frame) TTL() byte

func (Frame) TotalLength

func (self Frame) TotalLength() uint16

func (Frame) Version

func (self Frame) Version() byte

Jump to

Keyboard shortcuts

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