layers

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 18 Imported by: 3

Documentation

Overview

Package layers

Index

Constants

View Source
const (
	ICMPv6OptLenLLA        int = 1 // length in 8 octets with 6 byte hardware address
	ICMPv6OptLenPrefixInfo int = 4
	ICMPv6OptLenMTU        int = 1
	ICMPv6OptLenRDNSS      int = 3
	ICMPv6RSLen            int = 8
	ICMPv6RALen            int = 16
	ICMPv6NSLen            int = 24
	ICMPv6NALen            int = 24
)
View Source
const (
	HandshakeTLSVal   = 0x16 // 22
	ClientHelloTLSVal = 0x01
	ServerHelloTLSVal = 0x02
)
View Source
const HeaderSizeEthernet = 14
View Source
const HeaderSizeIPv6 = 40

Variables

View Source
var (
	DNSRCodeNoError   = &DNSRCode{Val: RCodeNoError, Desc: "No error"}
	DNSRCodeFormatErr = &DNSRCode{Val: RCodeFormatError, Desc: "Format error"}
	DNSRCodeServFail  = &DNSRCode{Val: RCodeServerFail, Desc: "Server failed to complete the DNS request"}
	DNSRCodeNXDomain  = &DNSRCode{Val: RCodeNameError, Desc: "Domain name does not exist"}
	DNSRCodeNotImpl   = &DNSRCode{Val: RCodeNotImpl, Desc: "Function not implemented"}
	DNSRCodeRefused   = &DNSRCode{Val: RCodeRefused, Desc: "The server refused to answer for the query"}
	DNSRCodeYXDomain  = &DNSRCode{Val: RCodeYXDomain, Desc: "Name that should not exist, does exist"}
	DNSRCodeYXRRSet   = &DNSRCode{Val: RCodeYXRRSet, Desc: "RRset that should not exist, does exist"}
	DNSRCodeNXRRSet   = &DNSRCode{Val: RCodeNXRRSet, Desc: "Server not authoritative for the zone"}
	DNSRCodeNotAuth   = &DNSRCode{Val: RCodeNotAuth, Desc: "Server Not Authoritative for zone"}
	DNSRCodeNotZone   = &DNSRCode{Val: RCodeNotZone, Desc: "Name not contained in zone"}
	DNSRCodeDSOTypeNI = &DNSRCode{Val: RCodeDSOTypeNI, Desc: "DSO-TYPE Not Implemented"}
	DNSRCodeBadVers   = &DNSRCode{Val: RCodeBadVers, Desc: "Bad OPT Version/TSIG Signature Failure"}
	DNSRCodeBadKey    = &DNSRCode{Val: RCodeBadKey, Desc: "Key not recognized"}
	DNSRCodeBadTime   = &DNSRCode{Val: RCodeBadTime, Desc: "Signature out of time window"}
	DNSRCodeBadMode   = &DNSRCode{Val: RCodeBadMode, Desc: "Bad TKEY Mode"}
	DNSRCodeBadName   = &DNSRCode{Val: RCodeBadName, Desc: "Duplicate key name"}
	DNSRCodeBadAlg    = &DNSRCode{Val: RCodeBadAlg, Desc: "Algorithm not supported"}
	DNSRCodeBadTrunc  = &DNSRCode{Val: RCodeBadTrunc, Desc: "Bad Truncation"}
	DNSRCodeBadCookie = &DNSRCode{Val: RCodeBadCookie, Desc: "Bad/missing Server Cookie"}
)
View Source
var (
	ErrParsingAddress = fmt.Errorf("failed parsing IP address")
	ErrSliceBounds    = fmt.Errorf("slice bounds out of range")
)
View Source
var ErrTLSTooShort = fmt.Errorf("tls message too short")

Functions

func CalculateIPv4Checksum added in v0.0.9

func CalculateIPv4Checksum(data []byte) (uint16, error)

func CalculateInternetChecksum added in v0.0.21

func CalculateInternetChecksum(data []byte, checksumOffset int) (uint16, error)

func GenerateRandomBytes added in v0.0.14

func GenerateRandomBytes(n int) ([]byte, error)

func GenerateRandomUint16BE added in v0.0.14

func GenerateRandomUint16BE() (uint16, error)

func GenerateRandomUint16LE added in v0.0.14

func GenerateRandomUint16LE() (uint16, error)

func GenerateRandomUint16NE added in v0.0.14

func GenerateRandomUint16NE() (uint16, error)

func GenerateRandomUint32BE added in v0.0.23

func GenerateRandomUint32BE() (uint32, error)

func GenerateRandomUint32LE added in v0.0.23

func GenerateRandomUint32LE() (uint32, error)

func MustGenerateRandomUint16NE added in v0.0.14

func MustGenerateRandomUint16NE() uint16

func MustGenerateRandomUint32BE added in v0.0.23

func MustGenerateRandomUint32BE() uint32

func MustGenerateRandomUint32LE added in v0.0.23

func MustGenerateRandomUint32LE() uint32

Types

type ARPOperation added in v0.0.6

type ARPOperation struct {
	Val  Operation
	Desc string
}

func (*ARPOperation) String added in v0.0.6

func (ao *ARPOperation) String() string

type ARPPacket

type ARPPacket struct {
	HardwareType     uint16        // Network link protocol type.
	ProtocolType     uint16        // Internetwork protocol for which the ARP request is intended.
	ProtocolTypeDesc string        // Internetwork protocol description.
	Hlen             uint8         // Length (in octets) of a hardware address.
	Plen             uint8         // Length (in octets) of internetwork addresses.
	Op               *ARPOperation // Specifies the operation that the sender is performing.
	// Media address of the sender. In an ARP request this field is used to indicate
	// the address of the host sending the request. In an ARP reply this field is used
	// to indicate the address of the host that the request was looking for.
	SenderMAC net.HardwareAddr
	SenderIP  netip.Addr // Internetwork address of the sender.
	// Media address of the intended receiver. In an ARP request this field is ignored.
	// In an ARP reply this field is used to indicate the address of the host that originated the ARP request.
	TargetMAC net.HardwareAddr
	TargetIP  netip.Addr // Internetwork address of the intended receiver.
	DstVendor string
	SrcVendor string
}

ARPPacket represents The Address Resolution Protocol (ARP) that is a communication protocol used for discovering the link layer address, such as a MAC address, associated with a given internet layer address, typically an IPv4 address. Defined in RFC 826.

func NewARPPacket added in v0.0.6

func NewARPPacket(
	op Operation,
	senderMAC net.HardwareAddr,
	senderIP netip.Addr,
	targetMAC net.HardwareAddr,
	targetIP netip.Addr,
) (*ARPPacket, error)

func (*ARPPacket) MarshalBinary added in v0.0.6

func (ap *ARPPacket) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface

func (*ARPPacket) Name added in v0.0.13

func (ap *ARPPacket) Name() LayerName

func (*ARPPacket) NextLayer

func (ap *ARPPacket) NextLayer() Layer

func (*ARPPacket) Parse

func (ap *ARPPacket) Parse(data []byte) error

Parse parses the given ARP packet data into the ARPPacket struct.

func (*ARPPacket) String

func (ap *ARPPacket) String() string

func (*ARPPacket) Summary

func (ap *ARPPacket) Summary() string

func (*ARPPacket) ToBytes added in v0.0.6

func (ap *ARPPacket) ToBytes() []byte

func (*ARPPacket) UnmarshalBinary added in v0.0.6

func (ap *ARPPacket) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface

type CipherSuite added in v0.0.3

type CipherSuite struct {
	Value uint16
	Desc  string
}

func (*CipherSuite) String added in v0.0.3

func (cs *CipherSuite) String() string

type DNSFlags

type DNSFlags struct {
	Raw    uint16     `json:"raw"`
	QR     *DNSQRFlag `json:"qr"`     // Indicates if the message is a query (0) or a reply (1).
	OPCode *DNSOpCode `json:"opcode"` // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5
	AA     uint8      `json:"aa"`     // Authoritative Answer, in a response, indicates if the DNS server is authoritative for the queried hostname.
	TC     uint8      `json:"tc"`     // TrunCation, indicates that this message was truncated due to excessive length.
	RD     uint8      `json:"rd"`     // Recursion Desired, indicates if the client means a recursive query.
	RA     uint8      `json:"ra"`     // Recursion Available, in a response, indicates if the replying DNS server supports recursion.
	Z      uint8      `json:"z"`      // Zero, reserved for future use.
	AU     uint8      `json:"au"`     // Indicates if answer/authority portion was authenticated by the server.
	NA     uint8      `json:"na"`     // Indicates if non-authenticated data is accepatable.
	RCode  *DNSRCode  `json:"rcode"`  // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6
}

func NewDNSFlags added in v0.0.24

func NewDNSFlags(qr QRFlag, op OpCode, aa, tc, rd, ra, z, au, na bool, rc RCode) *DNSFlags

func NewDNSFlagsFromRaw added in v0.0.24

func NewDNSFlagsFromRaw(flags uint16) *DNSFlags

func (*DNSFlags) String

func (df *DNSFlags) String() string

type DNSMessage

type DNSMessage struct {
	TransactionID uint16            `json:"transaction-id"`       // Used for matching response to queries.
	Flags         *DNSFlags         `json:"flags,omitempty"`      // Flags specify the requested operation and a response code.
	QDCount       uint16            `json:"questions-count"`      // Count of entries in the queries section.
	ANCount       uint16            `json:"answer-rrs-count"`     //  Count of entries in the answers section.
	NSCount       uint16            `json:"authority-rrs-count"`  // Count of entries in the authority section.
	ARCount       uint16            `json:"additional-rrs-count"` // Count of entries in the additional section.
	Questions     []*QueryEntry     `json:"questions,omitempty"`
	AnswerRRs     []*ResourceRecord `json:"answers,omitempty"`
	AuthorityRRs  []*ResourceRecord `json:"authoritative-nameservers,omitempty"`
	AdditionalRRs []*ResourceRecord `json:"additional-records,omitempty"`
}

func NewDNSMessage added in v0.0.24

func NewDNSMessage(tid uint16, flags *DNSFlags, qd []*QueryEntry, an, ns, ar []*ResourceRecord) (*DNSMessage, error)

func (*DNSMessage) MarshalBinary added in v0.0.24

func (d *DNSMessage) MarshalBinary() ([]byte, error)

func (*DNSMessage) MarshalJSON added in v0.0.13

func (d *DNSMessage) MarshalJSON() ([]byte, error)

func (*DNSMessage) Name added in v0.0.13

func (d *DNSMessage) Name() LayerName

func (*DNSMessage) NextLayer

func (d *DNSMessage) NextLayer() Layer

func (*DNSMessage) Parse

func (d *DNSMessage) Parse(data []byte) error

Parse parses the given byte data into a DNSMessage struct.

func (*DNSMessage) String

func (d *DNSMessage) String() string

func (*DNSMessage) Summary

func (d *DNSMessage) Summary() string

func (*DNSMessage) ToBytes added in v0.0.24

func (d *DNSMessage) ToBytes() []byte

func (*DNSMessage) UnmarshalBinary added in v0.0.13

func (d *DNSMessage) UnmarshalBinary(data []byte) error

type DNSOpCode added in v0.0.24

type DNSOpCode struct {
	Val  OpCode `json:"val"`
	Desc string `json:"desc"`
}
var (
	DNSOpCodeQuery    *DNSOpCode = &DNSOpCode{Val: OpCodeQuery, Desc: "Standard query"}
	DNSOpCodeInvQuery *DNSOpCode = &DNSOpCode{Val: OpCodeInvQuery, Desc: "Inverse query"}
	DNSOpCodeStatus   *DNSOpCode = &DNSOpCode{Val: OpCodeStatus, Desc: "Server status request"}
	DNSOpCodeNotify   *DNSOpCode = &DNSOpCode{Val: OpCodeNotify, Desc: "Notify"}
	DNSOpCodeUpdate   *DNSOpCode = &DNSOpCode{Val: OpCodeUpdate, Desc: "Update"}
	DNSOpCodeDSO      *DNSOpCode = &DNSOpCode{Val: OpCodeDSO, Desc: "Stateful operation"}
)

func NewDNSOpCode added in v0.0.24

func NewDNSOpCode(opcode OpCode) *DNSOpCode

func (*DNSOpCode) String added in v0.0.24

func (do *DNSOpCode) String() string

type DNSQRFlag added in v0.0.24

type DNSQRFlag struct {
	Val  QRFlag `json:"val"`
	Desc string `json:"desc"`
}
var (
	DNSQuery *DNSQRFlag = &DNSQRFlag{Val: QRFlagQuery, Desc: "query"}
	DNSReply *DNSQRFlag = &DNSQRFlag{Val: QRFlagReply, Desc: "reply"}
)

func NewDNSQRFlag added in v0.0.24

func NewDNSQRFlag(qr QRFlag) *DNSQRFlag

func (*DNSQRFlag) String added in v0.0.24

func (qr *DNSQRFlag) String() string

type DNSRCode added in v0.0.24

type DNSRCode struct {
	Val  RCode  `json:"val"`
	Desc string `json:"desc"`
}

func NewDNSRCode added in v0.0.24

func NewDNSRCode(rc RCode) *DNSRCode

func (*DNSRCode) String added in v0.0.24

func (rc *DNSRCode) String() string

type DestOptsExtHeader added in v0.0.23

type DestOptsExtHeader struct {
	NextHeader *IPProtocol // Identifies the type of header immediately following the Destination Options header.
	HdrExtLen  uint8       // Length of the Hop-by-Hop Options header in 8-octet units, not including the first 8 octets.
	Options    []TLVOpt    /* Variable-length field, of length such that the complete Destination Options header is an
	integer multiple of 8 octets long.  Contains one or more TLV-encoded options */
}

func (*DestOptsExtHeader) MarshalBinary added in v0.0.23

func (dst *DestOptsExtHeader) MarshalBinary() ([]byte, error)

func (*DestOptsExtHeader) SetNextHeader added in v0.0.23

func (dst *DestOptsExtHeader) SetNextHeader(next *IPProtocol)

func (*DestOptsExtHeader) ToBytes added in v0.0.23

func (dst *DestOptsExtHeader) ToBytes() []byte

func (*DestOptsExtHeader) Type added in v0.0.23

func (dst *DestOptsExtHeader) Type() IPv6ExtHdrType

type EtherType added in v0.0.6

type EtherType uint16
const (
	EtherTypeIPv4 EtherType = 0x0800
	EtherTypeARP  EtherType = 0x0806
	EtherTypeIPv6 EtherType = 0x86dd
)

type EthernetFrame

type EthernetFrame struct {
	DstMAC    net.HardwareAddr // MAC address of the destination device.
	SrcMAC    net.HardwareAddr // MAC address of the source device.
	EtherType *EthernetType    // The protocol of the upper layer.
	Payload   []byte
	DstVendor string
	SrcVendor string
}

EthernetFrame represents Ethernet Frame An Ethernet frame is a data link layer protocol data unit.

func NewEthernetFrame added in v0.0.6

func NewEthernetFrame(dstMAC, srcMAC net.HardwareAddr, et EtherType, payload []byte) (*EthernetFrame, error)

func (*EthernetFrame) MarshalBinary added in v0.0.6

func (ef *EthernetFrame) MarshalBinary() ([]byte, error)

func (*EthernetFrame) Name added in v0.0.13

func (ef *EthernetFrame) Name() LayerName

func (*EthernetFrame) NextLayer

func (ef *EthernetFrame) NextLayer() Layer

func (*EthernetFrame) Parse

func (ef *EthernetFrame) Parse(data []byte) error

Parse parses the given byte data into an Ethernet frame.

func (*EthernetFrame) String

func (ef *EthernetFrame) String() string

func (*EthernetFrame) Summary

func (ef *EthernetFrame) Summary() string

func (*EthernetFrame) ToBytes added in v0.0.6

func (ef *EthernetFrame) ToBytes() []byte

func (*EthernetFrame) UnmarshalBinary added in v0.0.6

func (ef *EthernetFrame) UnmarshalBinary(data []byte) error

type EthernetType added in v0.0.6

type EthernetType struct {
	Val  EtherType
	Desc string // Protocol description
}

func (*EthernetType) String added in v0.0.6

func (et *EthernetType) String() string

type Extension added in v0.0.3

type Extension struct {
	Value uint16
	Desc  string
}

func (*Extension) String added in v0.0.3

func (e *Extension) String() string

type FTPMessage

type FTPMessage struct {
	// contains filtered or unexported fields
}

func (*FTPMessage) Name added in v0.0.13

func (f *FTPMessage) Name() LayerName

func (*FTPMessage) NextLayer

func (f *FTPMessage) NextLayer() Layer

func (*FTPMessage) Parse

func (f *FTPMessage) Parse(data []byte) error

func (*FTPMessage) String

func (f *FTPMessage) String() string

func (*FTPMessage) Summary

func (f *FTPMessage) Summary() string

type FragmentExtHeader added in v0.0.23

type FragmentExtHeader struct {
	NextHeader *IPProtocol // Identifies the type of header immediately following the Routing header.
	// Reserved uint8
	FragmentOffset uint16 /* 13-bit unsigned integer.  The offset, in 8-octet units, of the data following this
	header, relative to the start of the Fragmentable Part of the original packet. */
	M              bool // 1 = more fragments; 0 = last fragment.
	Identification uint32
}

func (*FragmentExtHeader) MarshalBinary added in v0.0.23

func (fr *FragmentExtHeader) MarshalBinary() ([]byte, error)

func (*FragmentExtHeader) SetNextHeader added in v0.0.23

func (fr *FragmentExtHeader) SetNextHeader(next *IPProtocol)

func (*FragmentExtHeader) ToBytes added in v0.0.23

func (fr *FragmentExtHeader) ToBytes() []byte

func (*FragmentExtHeader) Type added in v0.0.23

func (fr *FragmentExtHeader) Type() IPv6ExtHdrType

type HSTLSParser added in v0.0.3

type HSTLSParser interface {
	ParseHS(data []byte) error
}

func HSTLSParserByType added in v0.0.3

func HSTLSParserByType(hstype uint8) HSTLSParser

type HTTPMessage

type HTTPMessage struct {
	Request  *http.Request
	Response *http.Response
}

https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages port 80

func (*HTTPMessage) IsEmpty added in v0.0.3

func (h *HTTPMessage) IsEmpty() bool

func (*HTTPMessage) MarshalJSON added in v0.0.4

func (h *HTTPMessage) MarshalJSON() ([]byte, error)

func (*HTTPMessage) Name added in v0.0.13

func (h *HTTPMessage) Name() LayerName

func (*HTTPMessage) NextLayer

func (h *HTTPMessage) NextLayer() Layer

func (*HTTPMessage) Parse

func (h *HTTPMessage) Parse(data []byte) error

func (*HTTPMessage) String

func (h *HTTPMessage) String() string

func (*HTTPMessage) Summary

func (h *HTTPMessage) Summary() string

type HTTPRequest added in v0.0.4

type HTTPRequest struct {
	Host          string      `json:"host,omitempty"`
	URI           string      `json:"uri,omitempty"`
	Method        string      `json:"method,omitempty"`
	Proto         string      `json:"proto,omitempty"`
	ContentLength int         `json:"content-length,omitempty"`
	Header        http.Header `json:"header,omitempty"`
}

type HTTPRequestWrapper added in v0.0.4

type HTTPRequestWrapper struct {
	Request *HTTPRequest `json:"http_request"`
}

type HTTPResponse added in v0.0.4

type HTTPResponse struct {
	Proto         string      `json:"proto,omitempty"`
	Status        string      `json:"status,omitempty"`
	ContentLength int         `json:"content-length,omitempty"`
	Header        http.Header `json:"header,omitempty"`
}

type HTTPResponseWrapper added in v0.0.4

type HTTPResponseWrapper struct {
	Response *HTTPResponse `json:"http_response"`
}

type HopByHopExtHeader added in v0.0.23

type HopByHopExtHeader struct {
	NextHeader *IPProtocol // Identifies the type of header immediately following the Hop-by-Hop Options header.
	HdrExtLen  uint8       // Length of the Hop-by-Hop Options header in 8-octet units, not including the first 8 octets.
	Options    []TLVOpt    /* Variable-length field, of length such that the complete Hop-by-Hop Options header is an
	integer multiple of 8 octets long.  Contains one or more TLV-encoded options, as described in Section 4.2 */
}

HopByHopExtHeader described in https://datatracker.ietf.org/doc/html/rfc8200#section-4.3

func (*HopByHopExtHeader) MarshalBinary added in v0.0.23

func (hbh *HopByHopExtHeader) MarshalBinary() ([]byte, error)

func (*HopByHopExtHeader) SetNextHeader added in v0.0.23

func (hbh *HopByHopExtHeader) SetNextHeader(next *IPProtocol)

func (*HopByHopExtHeader) ToBytes added in v0.0.23

func (hbh *HopByHopExtHeader) ToBytes() []byte

func (*HopByHopExtHeader) Type added in v0.0.23

func (hbh *HopByHopExtHeader) Type() IPv6ExtHdrType

type ICMPSegment

type ICMPSegment struct {
	Type     uint8  // ICMP type.
	TypeDesc string // ICMP type description.
	Code     uint8  // ICMP subtype.
	CodeDesc string // ICMP subtype description.
	// Internet checksum (RFC 1071) for error checking, calculated from the ICMP header
	// and data with value 0 substituted for this field.
	Checksum uint16
	Data     []byte // Contents vary based on the ICMP type and code.
}

ICMP is part of the Internet protocol suite as defined in RFC 792.

func (*ICMPSegment) Name added in v0.0.13

func (i *ICMPSegment) Name() LayerName

func (*ICMPSegment) NextLayer

func (i *ICMPSegment) NextLayer() Layer

func (*ICMPSegment) Parse

func (i *ICMPSegment) Parse(data []byte) error

Parse parses the given byte data into an ICMP segment struct.

func (*ICMPSegment) String

func (i *ICMPSegment) String() string

func (*ICMPSegment) Summary

func (i *ICMPSegment) Summary() string

type ICMPv6Message added in v0.0.21

type ICMPv6Message interface {
	Type() ICMPv6MessageType
	MarshalBinary() ([]byte, error)
	ToBytes() []byte
	SetChecksum(pseudo []byte) error
}

type ICMPv6MessageType added in v0.0.21

type ICMPv6MessageType uint8
const (
	ICMPv6TypeRouterSolicitation    ICMPv6MessageType = 133
	ICMPv6TypeRouterAdvertisement   ICMPv6MessageType = 134
	ICMPv6TypeNeighborSolicitation  ICMPv6MessageType = 135
	ICMPv6TypeNeighborAdvertisement ICMPv6MessageType = 136
)

type ICMPv6NeighborAdvertisement added in v0.0.21

type ICMPv6NeighborAdvertisement struct {
	Checksum      uint16
	Router        bool
	Solicited     bool
	Override      bool
	TargetAddress netip.Addr
	Options       []ICMPv6Option
}

ICMPv6NeighborAdvertisement format described in https://datatracker.ietf.org/doc/html/rfc2461#section-4.4

func (*ICMPv6NeighborAdvertisement) MarshalBinary added in v0.0.21

func (na *ICMPv6NeighborAdvertisement) MarshalBinary() ([]byte, error)

func (*ICMPv6NeighborAdvertisement) SetChecksum added in v0.0.21

func (na *ICMPv6NeighborAdvertisement) SetChecksum(pseudo []byte) error

func (*ICMPv6NeighborAdvertisement) ToBytes added in v0.0.21

func (na *ICMPv6NeighborAdvertisement) ToBytes() []byte

func (*ICMPv6NeighborAdvertisement) Type added in v0.0.21

type ICMPv6NeighborSolicitation added in v0.0.21

type ICMPv6NeighborSolicitation struct {
	Checksum      uint16
	TargetAddress netip.Addr
	Options       []ICMPv6Option
}

ICMPv6NeighborSolicitation format described in https://datatracker.ietf.org/doc/html/rfc2461#section-4.3

func (*ICMPv6NeighborSolicitation) MarshalBinary added in v0.0.21

func (ns *ICMPv6NeighborSolicitation) MarshalBinary() ([]byte, error)

func (*ICMPv6NeighborSolicitation) SetChecksum added in v0.0.21

func (ns *ICMPv6NeighborSolicitation) SetChecksum(pseudo []byte) error

func (*ICMPv6NeighborSolicitation) ToBytes added in v0.0.21

func (ns *ICMPv6NeighborSolicitation) ToBytes() []byte

func (*ICMPv6NeighborSolicitation) Type added in v0.0.21

type ICMPv6OptLinkLayerAddress added in v0.0.21

type ICMPv6OptLinkLayerAddress struct {
	Direction LLADirection
	Addr      net.HardwareAddr
}

ICMPv6OptLinkLayerAddress format described in https://datatracker.ietf.org/doc/html/rfc2461#section-4.6.1

func (*ICMPv6OptLinkLayerAddress) MarshalBinary added in v0.0.21

func (lla *ICMPv6OptLinkLayerAddress) MarshalBinary() ([]byte, error)

func (*ICMPv6OptLinkLayerAddress) OptType added in v0.0.21

func (*ICMPv6OptLinkLayerAddress) ToBytes added in v0.0.21

func (lla *ICMPv6OptLinkLayerAddress) ToBytes() []byte

type ICMPv6OptMTU added in v0.0.21

type ICMPv6OptMTU struct {
	MTU uint32
}

ICMPv6OptMTU format described in https://datatracker.ietf.org/doc/html/rfc2461#section-4.6.4

func (*ICMPv6OptMTU) MarshalBinary added in v0.0.21

func (om *ICMPv6OptMTU) MarshalBinary() ([]byte, error)

func (*ICMPv6OptMTU) OptType added in v0.0.21

func (om *ICMPv6OptMTU) OptType() ICMPv6OptionType

func (*ICMPv6OptMTU) ToBytes added in v0.0.21

func (om *ICMPv6OptMTU) ToBytes() []byte

type ICMPv6OptPrefixInfo added in v0.0.21

type ICMPv6OptPrefixInfo struct {
	PrefixLength                   uint8 // 0-128
	OnLink                         bool
	AutonomousAddressConfiguration bool
	ValidLifetime                  uint32
	PreferredLifetime              uint32
	Prefix                         netip.Addr
}

ICMPv6OptPrefixInfo format described in https://datatracker.ietf.org/doc/html/rfc2461#section-4.6.2

func (*ICMPv6OptPrefixInfo) MarshalBinary added in v0.0.21

func (pi *ICMPv6OptPrefixInfo) MarshalBinary() ([]byte, error)

func (*ICMPv6OptPrefixInfo) OptType added in v0.0.21

func (pi *ICMPv6OptPrefixInfo) OptType() ICMPv6OptionType

func (*ICMPv6OptPrefixInfo) ToBytes added in v0.0.21

func (pi *ICMPv6OptPrefixInfo) ToBytes() []byte

type ICMPv6OptRDNSS added in v0.0.21

type ICMPv6OptRDNSS struct {
	Lifetime  uint32
	Addresses []netip.Addr
}

ICMPv6OptRDNSS format described in https://datatracker.ietf.org/doc/html/rfc8106#section-5.1

func (*ICMPv6OptRDNSS) MarshalBinary added in v0.0.21

func (rd *ICMPv6OptRDNSS) MarshalBinary() ([]byte, error)

func (*ICMPv6OptRDNSS) OptType added in v0.0.21

func (rd *ICMPv6OptRDNSS) OptType() ICMPv6OptionType

func (*ICMPv6OptRDNSS) ToBytes added in v0.0.21

func (rd *ICMPv6OptRDNSS) ToBytes() []byte

type ICMPv6Option added in v0.0.21

type ICMPv6Option interface {
	OptType() ICMPv6OptionType
	MarshalBinary() ([]byte, error)
	ToBytes() []byte
}

type ICMPv6OptionType added in v0.0.21

type ICMPv6OptionType uint8
const (
	ICMPv6OptTypeSourceLLA  ICMPv6OptionType = 1
	ICMPv6OptTypeTargetLLA  ICMPv6OptionType = 2
	ICMPv6OptTypePrefixInfo ICMPv6OptionType = 3
	ICMPv6OptTypeMTU        ICMPv6OptionType = 5
	ICMPv6OptTypeRDNSS      ICMPv6OptionType = 25
)

type ICMPv6RouterAdvertisement added in v0.0.21

type ICMPv6RouterAdvertisement struct {
	Checksum             uint16
	CurHopLimit          uint8
	ManagedConfiguration bool
	OtherConfiguration   bool
	HomeAgent            bool
	Prf                  ICMPv6RouterPreference
	NDProxy              bool
	SNACRouter           bool
	RouterLifetime       uint16
	ReachableTime        uint32
	RetranstTimer        uint32
	Options              []ICMPv6Option
}

ICMPv6RouterAdvertisement format described in https://datatracker.ietf.org/doc/html/rfc2461#section-4.2

func (*ICMPv6RouterAdvertisement) MarshalBinary added in v0.0.21

func (ra *ICMPv6RouterAdvertisement) MarshalBinary() ([]byte, error)

func (*ICMPv6RouterAdvertisement) SetChecksum added in v0.0.21

func (ra *ICMPv6RouterAdvertisement) SetChecksum(pseudo []byte) error

func (*ICMPv6RouterAdvertisement) ToBytes added in v0.0.21

func (ra *ICMPv6RouterAdvertisement) ToBytes() []byte

func (*ICMPv6RouterAdvertisement) Type added in v0.0.21

type ICMPv6RouterPreference added in v0.0.21

type ICMPv6RouterPreference int
const (
	ICMPv6RouterPreferenceHigh     ICMPv6RouterPreference = 0b01
	ICMPv6RouterPreferenceMedium   ICMPv6RouterPreference = 0b00
	ICMPv6RouterPreferenceLow      ICMPv6RouterPreference = 0b11
	ICMPv6RouterPreferenceReserved ICMPv6RouterPreference = 0b10
)

type ICMPv6RouterSolicitation added in v0.0.21

type ICMPv6RouterSolicitation struct {
	Checksum uint16
	Options  []ICMPv6Option
}

ICMPv6RouterSolicitation format described in https://datatracker.ietf.org/doc/html/rfc2461#section-4.1

func (*ICMPv6RouterSolicitation) MarshalBinary added in v0.0.21

func (rs *ICMPv6RouterSolicitation) MarshalBinary() ([]byte, error)

func (*ICMPv6RouterSolicitation) SetChecksum added in v0.0.21

func (rs *ICMPv6RouterSolicitation) SetChecksum(pseudo []byte) error

func (*ICMPv6RouterSolicitation) ToBytes added in v0.0.21

func (rs *ICMPv6RouterSolicitation) ToBytes() []byte

func (*ICMPv6RouterSolicitation) Type added in v0.0.21

type ICMPv6Segment

type ICMPv6Segment struct {
	Type     uint8
	TypeDesc string
	Code     uint8
	CodeDesc string
	Checksum uint16
	Data     []byte
}

ICMPv6Segment is an integral part of IPv6 and performs error reporting and diagnostic functions.

func (*ICMPv6Segment) MarshalBinary added in v0.0.21

func (i *ICMPv6Segment) MarshalBinary() ([]byte, error)

func (*ICMPv6Segment) Name added in v0.0.13

func (i *ICMPv6Segment) Name() LayerName

func (*ICMPv6Segment) NextLayer

func (i *ICMPv6Segment) NextLayer() Layer

func (*ICMPv6Segment) Parse

func (i *ICMPv6Segment) Parse(data []byte) error

Parse parses the given byte data into an ICMPv6 segment struct.

func (*ICMPv6Segment) String

func (i *ICMPv6Segment) String() string

func (*ICMPv6Segment) Summary

func (i *ICMPv6Segment) Summary() string

func (*ICMPv6Segment) ToBytes added in v0.0.21

func (i *ICMPv6Segment) ToBytes() []byte

func (*ICMPv6Segment) UnmarshalBinary added in v0.0.21

func (i *ICMPv6Segment) UnmarshalBinary(data []byte) error

type IPProto added in v0.0.9

type IPProto uint8
const (
	ProtoHOPOPT     IPProto = 0
	ProtoICMP       IPProto = 1
	ProtoTCP        IPProto = 6
	ProtoUDP        IPProto = 17
	ProtoRoute      IPProto = 43
	ProtoFragment   IPProto = 44
	ProtoESP        IPProto = 50
	ProtoAuthHeader IPProto = 51
	ProtoICMPv6     IPProto = 58
	ProtoNoNxt      IPProto = 59
	ProtoOpts       IPProto = 60
	ProtoMobility   IPProto = 135
	ProtoHIP        IPProto = 139
	ProtoShim6      IPProto = 140
)

type IPProtocol added in v0.0.21

type IPProtocol struct {
	Val  IPProto // 8 bits defines the protocol used in the data portion of the IP datagram.
	Desc string  // Protocol description.
}
var (
	IPProtocolHOPOPT     *IPProtocol = &IPProtocol{Val: ProtoHOPOPT, Desc: "HOPOPT"}
	IPProtocolICMP       *IPProtocol = &IPProtocol{Val: ProtoICMP, Desc: "ICMP"}
	IPProtocolTCP        *IPProtocol = &IPProtocol{Val: ProtoTCP, Desc: "TCP"}
	IPProtocolUDP        *IPProtocol = &IPProtocol{Val: ProtoUDP, Desc: "UDP"}
	IPProtocolRoute      *IPProtocol = &IPProtocol{Val: ProtoRoute, Desc: "Route"}
	IPProtocolFragment   *IPProtocol = &IPProtocol{Val: ProtoFragment, Desc: "Fragment"}
	IPProtocolESP        *IPProtocol = &IPProtocol{Val: ProtoESP, Desc: "Encapsulating Security payload"}
	IPProtocolAuthHeader *IPProtocol = &IPProtocol{Val: ProtoAuthHeader, Desc: "Authentication Header"}
	IPProtocolICMPv6     *IPProtocol = &IPProtocol{Val: ProtoICMPv6, Desc: "ICMPv6"}
	IPProtocolNoNxt      *IPProtocol = &IPProtocol{Val: ProtoNoNxt, Desc: "NoNxt"}
	IPProtocolOpts       *IPProtocol = &IPProtocol{Val: ProtoOpts, Desc: "Dst Opts"}
	IPProtocolMobility   *IPProtocol = &IPProtocol{Val: ProtoMobility, Desc: "Mobility"}
	IPProtocolHIP        *IPProtocol = &IPProtocol{Val: ProtoHIP, Desc: "Host Identity Protocol"}
	IPProtocolShim6      *IPProtocol = &IPProtocol{Val: ProtoShim6, Desc: "Shim6 Protocol"}
)

func ExtHeaderProtoFromType added in v0.0.23

func ExtHeaderProtoFromType(eht IPv6ExtHdrType) *IPProtocol

func NewIPv4Proto added in v0.0.21

func NewIPv4Proto(proto IPProto) *IPProtocol

func NewIPv6Proto added in v0.0.21

func NewIPv6Proto(proto IPProto) *IPProtocol

func (*IPProtocol) String added in v0.0.21

func (p *IPProtocol) String() string

type IPv4Flags

type IPv4Flags struct {
	Raw      uint8
	Reserved uint8
	DF       uint8
	MF       uint8
}

func NewIPv4Flags added in v0.0.9

func NewIPv4Flags(flags uint8) *IPv4Flags

func (*IPv4Flags) String

func (i *IPv4Flags) String() string

type IPv4Packet

type IPv4Packet struct {
	// Internet Protocol version 4 is described in IETF publication RFC 791.
	Version        uint8      // 4 bits version (for IPv4, this is always equal to 4).
	IHL            uint8      // 4 bits size of header (number of 32-bit words).
	DSCP           uint8      // 6 bits specifies differentiated services.
	DSCPDesc       string     // differentiated services description.
	ECN            uint8      // 2 bits end-to-end notification of network congestion without dropping packets.
	TotalLength    uint16     // 16 bits defines the entire packet size in bytes, including header and data.
	Identification uint16     // 16 bits identifies the group of fragments of a single IP datagram.
	Flags          *IPv4Flags // 3 bits used to control or identify fragments.
	FragmentOffset uint16     // 13 bits offset of a particular fragment.
	TTL            uint8      // 8 bits limits a datagram's lifetime to prevent network failure.
	Protocol       *IPProtocol
	HeaderChecksum uint16     // 16 bits used for error checking of the header.
	SrcIP          netip.Addr // IPv4 address of the sender of the packet.
	DstIP          netip.Addr // IPv4 address of the receiver of the packet.
	Options        []byte     // if ihl > 5
	Payload        []byte
}

func NewIPv4Packet added in v0.0.9

func NewIPv4Packet(srcIP, dstIP netip.Addr, proto IPProto, payload []byte) (*IPv4Packet, error)

func (*IPv4Packet) MarshalBinary added in v0.0.9

func (p *IPv4Packet) MarshalBinary() ([]byte, error)

func (*IPv4Packet) Name added in v0.0.13

func (p *IPv4Packet) Name() LayerName

func (*IPv4Packet) NextLayer

func (p *IPv4Packet) NextLayer() Layer

func (*IPv4Packet) Parse

func (p *IPv4Packet) Parse(data []byte) error

Parse parses the given byte data into an IPv4 packet struct.

func (*IPv4Packet) PseudoHeader added in v0.0.9

func (p *IPv4Packet) PseudoHeader() *IPv4PseudoHeader

func (*IPv4Packet) SetPayload added in v0.0.13

func (p *IPv4Packet) SetPayload(payload []byte)

func (*IPv4Packet) String

func (p *IPv4Packet) String() string

func (*IPv4Packet) Summary

func (p *IPv4Packet) Summary() string

func (*IPv4Packet) ToBytes added in v0.0.9

func (p *IPv4Packet) ToBytes() []byte

func (*IPv4Packet) UnmarshalBinary added in v0.0.9

func (p *IPv4Packet) UnmarshalBinary(data []byte) error

type IPv4PseudoHeader added in v0.0.9

type IPv4PseudoHeader struct {
	SrcIP       netip.Addr
	DstIP       netip.Addr
	Protocol    *IPProtocol
	TotalLength uint16
}

func (*IPv4PseudoHeader) MarshalBinary added in v0.0.9

func (ph *IPv4PseudoHeader) MarshalBinary() ([]byte, error)

func (*IPv4PseudoHeader) ToBytes added in v0.0.9

func (ph *IPv4PseudoHeader) ToBytes() []byte

type IPv6ExtHdrOptType added in v0.0.23

type IPv6ExtHdrOptType uint8
const (
	OptPad1                            IPv6ExtHdrOptType = 0x00
	OptPadN                            IPv6ExtHdrOptType = 0x01
	OptJumboPayload                    IPv6ExtHdrOptType = 0xC2
	OptRPL                             IPv6ExtHdrOptType = 0x23
	OptRPL2                            IPv6ExtHdrOptType = 0x63
	OptTunnelEncapsulationLimit        IPv6ExtHdrOptType = 0x04
	OptRouterAlert                     IPv6ExtHdrOptType = 0x05
	OptQuickStart                      IPv6ExtHdrOptType = 0x26
	OptCALIPSO                         IPv6ExtHdrOptType = 0x07
	OptSMFDPD                          IPv6ExtHdrOptType = 0x08
	OptHomeAddress                     IPv6ExtHdrOptType = 0xC9
	OptEndpointIdentification          IPv6ExtHdrOptType = 0x8A
	OptILNPNonce                       IPv6ExtHdrOptType = 0x8B
	OptLineIdentification              IPv6ExtHdrOptType = 0x8C
	OptDeprecated                      IPv6ExtHdrOptType = 0x4D
	OptMPL                             IPv6ExtHdrOptType = 0x6D
	OptIPDFF                           IPv6ExtHdrOptType = 0xEE
	OptPerformanceandDiagnosticMetrics IPv6ExtHdrOptType = 0x0F
	OptMinimumPathMTUHopbyHop          IPv6ExtHdrOptType = 0x30
	OptIOAMDestinationandIOAMHopbyHop  IPv6ExtHdrOptType = 0x11
	OptIOAMDestinationandIOAMHopbyHop2 IPv6ExtHdrOptType = 0x31
	OptAltMark                         IPv6ExtHdrOptType = 0x12
)

type IPv6ExtHdrType added in v0.0.23

type IPv6ExtHdrType uint8
const (
	ExtHdrHOPOPT     IPv6ExtHdrType = 0
	ExtHdrRoute      IPv6ExtHdrType = 43
	ExtHdrFragment   IPv6ExtHdrType = 44
	ExtHdrESP        IPv6ExtHdrType = 50
	ExtHdrAuthHeader IPv6ExtHdrType = 51
	ExtHdrNoNxt      IPv6ExtHdrType = 59
	ExtHdrOpts       IPv6ExtHdrType = 60
	ExtHdrMobility   IPv6ExtHdrType = 135
	ExtHdrHIP        IPv6ExtHdrType = 139
	ExtHdrShim6      IPv6ExtHdrType = 140
)

type IPv6ExtHeader added in v0.0.23

type IPv6ExtHeader interface {
	Type() IPv6ExtHdrType
	SetNextHeader(next *IPProtocol)
	MarshalBinary() ([]byte, error)
	ToBytes() []byte
}

type IPv6OptHomeAddress added in v0.0.23

type IPv6OptHomeAddress struct {
	// The alignment requirement for the Home Address option is 8n + 6.
	// OptDataLen uint8 /*8-bit unsigned integer.  Length of the option, in octets,
	// excluding the Option Type and Option Length fields.  This field MUST be set to 16.*/
	HomeAddress netip.Addr // The home address of the mobile node sending the packet. This address MUST be a unicast routable address.
}

IPv6OptHomeAddress described in https://datatracker.ietf.org/doc/html/rfc6275#section-6.3

func (*IPv6OptHomeAddress) MarshalBinary added in v0.0.23

func (ha *IPv6OptHomeAddress) MarshalBinary() ([]byte, error)

func (*IPv6OptHomeAddress) ToBytes added in v0.0.23

func (ha *IPv6OptHomeAddress) ToBytes() []byte

func (*IPv6OptHomeAddress) Type added in v0.0.23

type IPv6OptPad1 added in v0.0.23

type IPv6OptPad1 struct{}

func (*IPv6OptPad1) MarshalBinary added in v0.0.23

func (pad1 *IPv6OptPad1) MarshalBinary() ([]byte, error)

func (*IPv6OptPad1) ToBytes added in v0.0.23

func (pad1 *IPv6OptPad1) ToBytes() []byte

func (*IPv6OptPad1) Type added in v0.0.23

func (pad1 *IPv6OptPad1) Type() IPv6ExtHdrOptType

type IPv6OptPad1M added in v0.0.23

type IPv6OptPad1M struct {
	Count int // number of bytes to add

} // made up

func (*IPv6OptPad1M) MarshalBinary added in v0.0.23

func (pad1m *IPv6OptPad1M) MarshalBinary() ([]byte, error)

func (*IPv6OptPad1M) ToBytes added in v0.0.23

func (pad1m *IPv6OptPad1M) ToBytes() []byte

func (*IPv6OptPad1M) Type added in v0.0.23

func (pad1m *IPv6OptPad1M) Type() IPv6ExtHdrOptType

type IPv6OptPadN added in v0.0.23

type IPv6OptPadN struct {
	/*
		The PadN option is used to insert two or more octets of padding
		into the Options area of a header.  For N octets of padding, the
		Opt Data Len field contains the value N-2, and the Option Data
		consists of N-2 zero-valued octets.
	*/
	OptDataLen uint8 // Length of the Option Data field of this option, in octets.
}

IPv6OptPadN described in https://datatracker.ietf.org/doc/html/rfc8200#section-4.2

func (*IPv6OptPadN) MarshalBinary added in v0.0.23

func (padn *IPv6OptPadN) MarshalBinary() ([]byte, error)

func (*IPv6OptPadN) ToBytes added in v0.0.23

func (padn *IPv6OptPadN) ToBytes() []byte

func (*IPv6OptPadN) Type added in v0.0.23

func (padn *IPv6OptPadN) Type() IPv6ExtHdrOptType

type IPv6Packet

type IPv6Packet struct {
	Version          uint8         // 4 bits version field (for IPv6, this is always equal to 6).
	TrafficClass     *TrafficClass // 6 + 2 bits holds DS and ECN values.
	FlowLabel        uint32        // 20 bits high-entropy identifier of a flow of packets between a source and destination.
	PayloadLength    uint16        // 16 bits the size of the payload in octets, including any extension headers.
	NextHeader       *IPProtocol   // 8 bits specifies the type of the next header.
	UpperLayer       *IPProtocol
	FinalDestination netip.Addr
	// 8 bits replaces the time to live field in IPv4. This value is decremented by one at each forwarding node
	// and the packet is discarded if it becomes 0. However, the destination node should process the packet normally
	// even if received with a hop limit of 0.
	HopLimit   uint8
	SrcIP      netip.Addr // The unicast IPv6 address of the sending node.
	DstIP      netip.Addr // The IPv6 unicast or multicast address of the destination node(s).
	ExtHeaders []IPv6ExtHeader
	Payload    []byte // Upper-layer payload
}

IPv6Packet is the smallest message entity exchanged using Internet Protocol version 6 (IPv6). IPv6 protocol defined in RFC 2460.

func NewIPv6Packet added in v0.0.21

func NewIPv6Packet(srcIP, dstIP netip.Addr, extHeaders []IPv6ExtHeader, upperLayer *IPProto, payload []byte) (*IPv6Packet, error)

func (*IPv6Packet) MarshalBinary added in v0.0.21

func (p *IPv6Packet) MarshalBinary() ([]byte, error)

func (*IPv6Packet) Name added in v0.0.13

func (p *IPv6Packet) Name() LayerName

func (*IPv6Packet) NextLayer

func (p *IPv6Packet) NextLayer() Layer

func (*IPv6Packet) Parse

func (p *IPv6Packet) Parse(data []byte) error

Parse parses the given byte data into an IPv6 packet struct.

func (*IPv6Packet) PseudoHeader added in v0.0.21

func (p *IPv6Packet) PseudoHeader() *IPv6PseudoHeader

func (*IPv6Packet) SetPayload added in v0.0.21

func (p *IPv6Packet) SetPayload(payload []byte)

func (*IPv6Packet) String

func (p *IPv6Packet) String() string

func (*IPv6Packet) Summary

func (p *IPv6Packet) Summary() string

func (*IPv6Packet) ToBytes added in v0.0.21

func (p *IPv6Packet) ToBytes() []byte

func (*IPv6Packet) UnmarshalBinary added in v0.0.21

func (p *IPv6Packet) UnmarshalBinary(data []byte) error

type IPv6PseudoHeader added in v0.0.21

type IPv6PseudoHeader struct {
	SrcIP                  netip.Addr
	DstIP                  netip.Addr
	UpperLayerPacketLength uint32
	NextHeader             *IPProtocol
}

func (*IPv6PseudoHeader) MarshalBinary added in v0.0.21

func (ph *IPv6PseudoHeader) MarshalBinary() ([]byte, error)

func (*IPv6PseudoHeader) ToBytes added in v0.0.21

func (ph *IPv6PseudoHeader) ToBytes() []byte

type IPv6RoutingType added in v0.0.23

type IPv6RoutingType uint8
const (
	SourceRoute          IPv6RoutingType = 0
	Nimrod               IPv6RoutingType = 1
	Type2RoutingHeader   IPv6RoutingType = 2
	RPLSourceRouteHeade  IPv6RoutingType = 3
	SegmentRoutingHeader IPv6RoutingType = 4
	CRH16                IPv6RoutingType = 5
	CRH32                IPv6RoutingType = 6
)

type LLADirection added in v0.0.21

type LLADirection uint8

type Layer

type Layer interface {
	fmt.Stringer
	Parse(data []byte) error
	NextLayer() Layer
	Summary() string
	Name() LayerName
}

func GetLayer added in v0.0.13

func GetLayer(layer LayerName) Layer

func ParseNextLayer added in v0.0.13

func ParseNextLayer(data []byte, src, dst *uint16) Layer

type LayerName added in v0.0.13

type LayerName string
const (
	LayerETH    LayerName = "ETH"
	LayerIPv4   LayerName = "IPv4"
	LayerIPv6   LayerName = "IPv6"
	LayerARP    LayerName = "ARP"
	LayerTCP    LayerName = "TCP"
	LayerUDP    LayerName = "UDP"
	LayerICMP   LayerName = "ICMP"
	LayerICMPv6 LayerName = "ICMPv6"
	LayerDNS    LayerName = "DNS"
	LayerFTP    LayerName = "FTP"
	LayerHTTP   LayerName = "HTTP"
	LayerSNMP   LayerName = "SNMP"
	LayerSSH    LayerName = "SSH"
	LayerTLS    LayerName = "TLS"
)

type Message

type Message struct {
	PacketLength     uint32
	PaddingLength    uint8
	MesssageType     uint8
	MesssageTypeDesc string
	Payload          []byte
}

func (*Message) String

func (m *Message) String() string

type MobilityExtHeader added in v0.0.23

type MobilityExtHeader struct {
	NextHeader *IPProtocol // Identifies the type of header immediately following the Mobility Header. Uses the same values as the IPv6 Next Header field
	HdrExtLen  uint8       // Length of the Hop-by-Hop Options header in 8-octet units, not including the first 8 octets.
	MHType     uint8       /* Identifies the particular mobility message in question. Current values are specified in Section 6.1.2 and onward.
	An unrecognized MH Type field causes an error indication to be sent. */
	// Reserved uint8
	Checksum uint16 /*
		          16-bit unsigned integer.  This field contains the checksum of the
				  Mobility Header.  The checksum is calculated from the octet string
				  consisting of a "pseudo-header" followed by the entire Mobility
				  Header starting with the Payload Proto field.  The checksum is the
				  16-bit one's complement of the one's complement sum of this
				  string.

				  The pseudo-header contains IPv6 header fields, as specified in
				  Section 8.1 of RFC 2460 [6].  The Next Header value used in the
				  pseudo-header is 135.  The addresses used in the pseudo-header are
				  the addresses that appear in the Source and Destination Address
				  fields in the IPv6 packet carrying the Mobility Header.
				  Note that the procedures of calculating upper-layer checksums
				  while away from home described in Section 11.3.1 apply even for
				  the Mobility Header.  If a mobility message has a Home Address
				  destination option, then the checksum calculation uses the home
				  address in this option as the value of the IPv6 Source Address
				  field.  The type 2 routing header is treated as explained in [6].

				  The Mobility Header is considered as the upper-layer protocol for
				  the purposes of calculating the pseudo-header.  The Upper-Layer
				  Packet Length field in the pseudo-header MUST be set to the total
				  length of the Mobility Header.

				  For computing the checksum, the checksum field is set to zero.
	*/
	MessageData []byte // A variable-length field containing the data specific to the indicated Mobility Header type.
	// Reserved uint16
	Options []TLVOpt
}

func (*MobilityExtHeader) MarshalBinary added in v0.0.23

func (mb *MobilityExtHeader) MarshalBinary() ([]byte, error)

func (*MobilityExtHeader) SetNextHeader added in v0.0.23

func (mb *MobilityExtHeader) SetNextHeader(next *IPProtocol)

func (*MobilityExtHeader) ToBytes added in v0.0.23

func (mb *MobilityExtHeader) ToBytes() []byte

func (*MobilityExtHeader) Type added in v0.0.23

func (mb *MobilityExtHeader) Type() IPv6ExtHdrType

type NoNextExtHeader added in v0.0.23

type NoNextExtHeader struct{}

func (*NoNextExtHeader) MarshalBinary added in v0.0.23

func (nn *NoNextExtHeader) MarshalBinary() ([]byte, error)

func (*NoNextExtHeader) SetNextHeader added in v0.0.23

func (nn *NoNextExtHeader) SetNextHeader(next *IPProtocol)

func (*NoNextExtHeader) ToBytes added in v0.0.23

func (nn *NoNextExtHeader) ToBytes() []byte

func (*NoNextExtHeader) Type added in v0.0.23

func (nn *NoNextExtHeader) Type() IPv6ExtHdrType

type OpCode added in v0.0.24

type OpCode uint8
const (
	OpCodeQuery    OpCode = 0
	OpCodeInvQuery OpCode = 1
	OpCodeStatus   OpCode = 2
	OpCodeNotify   OpCode = 4
	OpCodeUpdate   OpCode = 5
	OpCodeDSO      OpCode = 6
)

type Operation added in v0.0.6

type Operation uint16
const (
	OperationRequest Operation = 1
	OperationReply   Operation = 2
)

type QRFlag added in v0.0.24

type QRFlag uint8
const (
	QRFlagQuery QRFlag = 0
	QRFlagReply QRFlag = 1
)

type QueryEntry

type QueryEntry struct {
	Name  string       `json:"name"`         // Name of the node to which this record pertains.
	Type  *RecordType  `json:"record-type"`  // Type of RR in numeric form.
	Class *RecordClass `json:"record-class"` // Class code.
}

func (*QueryEntry) MarshalBinary added in v0.0.24

func (qe *QueryEntry) MarshalBinary() ([]byte, error)

func (*QueryEntry) String

func (qe *QueryEntry) String() string

func (*QueryEntry) ToBytes added in v0.0.24

func (qe *QueryEntry) ToBytes() []byte

type RCode added in v0.0.24

type RCode uint8
const (
	RCodeNoError     RCode = 0
	RCodeFormatError RCode = 1
	RCodeServerFail  RCode = 2
	RCodeNameError   RCode = 3
	RCodeNotImpl     RCode = 4
	RCodeRefused     RCode = 5
	RCodeYXDomain    RCode = 6
	RCodeYXRRSet     RCode = 7
	RCodeNXRRSet     RCode = 8
	RCodeNotAuth     RCode = 9
	RCodeNotZone     RCode = 10
	RCodeDSOTypeNI   RCode = 11
	RCodeBadVers     RCode = 16
	RCodeBadKey      RCode = 17
	RCodeBadTime     RCode = 18
	RCodeBadMode     RCode = 19
	RCodeBadName     RCode = 20
	RCodeBadAlg      RCode = 21
	RCodeBadTrunc    RCode = 22
	RCodeBadCookie   RCode = 23
)

type RData added in v0.0.24

type RData interface {
	fmt.Stringer
	encoding.BinaryMarshaler
	ToBytes() []byte
}

type RDataA

type RDataA struct {
	Address netip.Addr `json:"address"`
}

func (*RDataA) MarshalBinary added in v0.0.24

func (d *RDataA) MarshalBinary() ([]byte, error)

func (*RDataA) String

func (d *RDataA) String() string

func (*RDataA) ToBytes added in v0.0.24

func (d *RDataA) ToBytes() []byte

type RDataAAAA

type RDataAAAA struct {
	Address netip.Addr `json:"address"`
}

func (*RDataAAAA) MarshalBinary added in v0.0.24

func (d *RDataAAAA) MarshalBinary() ([]byte, error)

func (*RDataAAAA) String

func (d *RDataAAAA) String() string

func (*RDataAAAA) ToBytes added in v0.0.24

func (d *RDataAAAA) ToBytes() []byte

type RDataCNAME

type RDataCNAME struct {
	CName string `json:"cname"`
}

func (*RDataCNAME) MarshalBinary added in v0.0.24

func (d *RDataCNAME) MarshalBinary() ([]byte, error)

func (*RDataCNAME) String

func (d *RDataCNAME) String() string

func (*RDataCNAME) ToBytes added in v0.0.24

func (d *RDataCNAME) ToBytes() []byte

type RDataHTTPS

type RDataHTTPS struct {
	SvcPriority uint16      `json:"svc-priority"`
	Length      int         `json:"length"`
	TargetName  string      `json:"target-name"`
	SvcParams   []*SvcParam `json:"svc-params"`
}

func (*RDataHTTPS) MarshalBinary added in v0.0.24

func (d *RDataHTTPS) MarshalBinary() ([]byte, error)

func (*RDataHTTPS) String

func (d *RDataHTTPS) String() string

func (*RDataHTTPS) ToBytes added in v0.0.24

func (d *RDataHTTPS) ToBytes() []byte

type RDataMX

type RDataMX struct {
	Preference uint16 `json:"preference"`
	Exchange   string `json:"exchange"`
}

func (*RDataMX) MarshalBinary added in v0.0.24

func (d *RDataMX) MarshalBinary() ([]byte, error)

func (*RDataMX) String

func (d *RDataMX) String() string

func (*RDataMX) ToBytes added in v0.0.24

func (d *RDataMX) ToBytes() []byte

type RDataNS

type RDataNS struct {
	NsdName string `json:"ns"`
}

func (*RDataNS) MarshalBinary added in v0.0.24

func (d *RDataNS) MarshalBinary() ([]byte, error)

func (*RDataNS) String

func (d *RDataNS) String() string

func (*RDataNS) ToBytes added in v0.0.24

func (d *RDataNS) ToBytes() []byte

type RDataOPT

type RDataOPT struct {
	UDPPayloadSize     uint16 `json:"udp-payload-size"`
	HigherBitsExtRCode uint8  `json:"higer-bits-in-extended-rcode"`
	EDNSVer            uint8  `json:"edns0-version"`
	Z                  uint16 `json:"z"`
	DataLen            uint16 `json:"data-length"`
}

func (*RDataOPT) MarshalBinary added in v0.0.24

func (d *RDataOPT) MarshalBinary() ([]byte, error)

func (*RDataOPT) String

func (d *RDataOPT) String() string

func (*RDataOPT) ToBytes added in v0.0.24

func (d *RDataOPT) ToBytes() []byte

type RDataSOA

type RDataSOA struct {
	PrimaryNS            string `json:"primary-nameserver"`
	RespAuthorityMailbox string `json:"responsible-authority-mailbox"`
	SerialNumber         uint32 `json:"serial-number"`
	RefreshInterval      uint32 `json:"refresh-interval"`
	RetryInterval        uint32 `json:"retry-interval"`
	ExpireLimit          uint32 `json:"expire-limit"`
	MinimumTTL           uint32 `json:"minimum-ttl"`
}

func (*RDataSOA) MarshalBinary added in v0.0.24

func (d *RDataSOA) MarshalBinary() ([]byte, error)

func (*RDataSOA) String

func (d *RDataSOA) String() string

func (*RDataSOA) ToBytes added in v0.0.24

func (d *RDataSOA) ToBytes() []byte

type RDataTXT

type RDataTXT struct {
	TxtData string `json:"txt-data"`
}

func (*RDataTXT) MarshalBinary added in v0.0.24

func (d *RDataTXT) MarshalBinary() ([]byte, error)

func (*RDataTXT) String

func (d *RDataTXT) String() string

func (*RDataTXT) ToBytes added in v0.0.24

func (d *RDataTXT) ToBytes() []byte

type RDataUnknown

type RDataUnknown struct {
	Data []byte `json:"data"`
}

func (*RDataUnknown) MarshalBinary added in v0.0.24

func (d *RDataUnknown) MarshalBinary() ([]byte, error)

func (*RDataUnknown) String

func (d *RDataUnknown) String() string

func (*RDataUnknown) ToBytes added in v0.0.24

func (d *RDataUnknown) ToBytes() []byte

type RecType added in v0.0.24

type RecType uint16
const (
	RecTypeA     RecType = 1
	RecTypeNS    RecType = 2
	RecTypeCNAME RecType = 5
	RecTypeSOA   RecType = 6
	RecTypeMX    RecType = 15
	RecTypeTXT   RecType = 16
	RecTypeAAAA  RecType = 28
	RecTypeOPT   RecType = 41
	RecTypeHTTPS RecType = 65
)

type Record

type Record struct {
	ContentType     uint8
	ContentTypeDesc string
	Version         *TLSVersion
	Length          uint16
	Data            []byte
}

func (*Record) String

func (r *Record) String() string

type RecordClass

type RecordClass struct {
	Name string `json:"name"`
	Val  uint16 `json:"val"`
}

func NewRecordClass added in v0.0.24

func NewRecordClass(cls uint16) *RecordClass

func (*RecordClass) String

func (c *RecordClass) String() string

type RecordType

type RecordType struct {
	Name string  `json:"name"`
	Val  RecType `json:"val"`
}
var (
	DNSRecTypeA     *RecordType = &RecordType{Name: "A", Val: RecTypeA}
	DNSRecTypeNS    *RecordType = &RecordType{Name: "NS", Val: RecTypeNS}
	DNSRecTypeCNAME *RecordType = &RecordType{Name: "CNAME", Val: RecTypeCNAME}
	DNSRecTypeSOA   *RecordType = &RecordType{Name: "SOA", Val: RecTypeSOA}
	DNSRecTypeMX    *RecordType = &RecordType{Name: "MX", Val: RecTypeMX}
	DNSRecTypeTXT   *RecordType = &RecordType{Name: "TXT", Val: RecTypeTXT}
	DNSRecTypeAAAA  *RecordType = &RecordType{Name: "AAAA", Val: RecTypeAAAA}
	DNSRecTypeOPT   *RecordType = &RecordType{Name: "OPT", Val: RecTypeOPT}
	DNSRecTypeHTTPS *RecordType = &RecordType{Name: "HTTPS", Val: RecTypeHTTPS}
)

func NewRecordType added in v0.0.24

func NewRecordType(rt RecType) *RecordType

func (*RecordType) String

func (rt *RecordType) String() string

type ResourceRecord

type ResourceRecord struct {
	Name     string       `json:"name"`         // Name of the node to which this record pertains.
	Type     *RecordType  `json:"record-type"`  // Type of RR in numeric form.
	Class    *RecordClass `json:"record-class"` // Class code.
	TTL      uint32       `json:"ttl"`          // Count of seconds that the RR stays valid.
	RDLength uint16       `json:"rdata-length"` // Length of RData field (specified in octets).
	RData    RData        `json:"rdata"`        // Additional RR-specific data.
}

func (*ResourceRecord) MarshalBinary added in v0.0.24

func (rt *ResourceRecord) MarshalBinary() ([]byte, error)

func (*ResourceRecord) String

func (rt *ResourceRecord) String() string

func (*ResourceRecord) Summary added in v0.0.13

func (rt *ResourceRecord) Summary() string

func (*ResourceRecord) ToBytes added in v0.0.24

func (rt *ResourceRecord) ToBytes() []byte

type RoutingExtHeader added in v0.0.23

type RoutingExtHeader struct {
	NextHeader   *IPProtocol     // Identifies the type of header immediately following the Routing header.
	HdrExtLen    uint8           // Length of the Hop-by-Hop Options header in 8-octet units, not including the first 8 octets.
	RoutingType  IPv6RoutingType // identifier of a particular Routing header variant
	SegmentsLeft uint8           // Number of route segments remaining, i.e., number of explicitly listed intermediate nodes
	// still to be visited before reaching the final destination.
	Data []byte // type-specific data
}

func NewRouting0ExtHeader added in v0.0.23

func NewRouting0ExtHeader(next IPProto, addrs []netip.Addr) (*RoutingExtHeader, error)

func NewRouting2ExtHeader added in v0.0.23

func NewRouting2ExtHeader(next IPProto, homeAddress netip.Addr) (*RoutingExtHeader, error)

func (*RoutingExtHeader) MarshalBinary added in v0.0.23

func (rt *RoutingExtHeader) MarshalBinary() ([]byte, error)

func (*RoutingExtHeader) SetNextHeader added in v0.0.23

func (rt *RoutingExtHeader) SetNextHeader(next *IPProtocol)

func (*RoutingExtHeader) ToBytes added in v0.0.23

func (rt *RoutingExtHeader) ToBytes() []byte

func (*RoutingExtHeader) Type added in v0.0.23

func (rt *RoutingExtHeader) Type() IPv6ExtHdrType

type SNMPMessage

type SNMPMessage struct {
	Payload []byte
}

https://www.ranecommercial.com/legacy/pdf/ranenotes/SNMP_Simple_Network_Management_Protocol.pdf https://wiki.wireshark.org/SNMP port 161, 162

func (*SNMPMessage) Name added in v0.0.13

func (s *SNMPMessage) Name() LayerName

func (*SNMPMessage) NextLayer

func (s *SNMPMessage) NextLayer() Layer

func (*SNMPMessage) Parse

func (s *SNMPMessage) Parse(data []byte) error

func (*SNMPMessage) String

func (s *SNMPMessage) String() string

func (*SNMPMessage) Summary

func (s *SNMPMessage) Summary() string

type SSHMessage

type SSHMessage struct {
	Protocol string
	Messages []*Message
}

func (*SSHMessage) Name added in v0.0.13

func (s *SSHMessage) Name() LayerName

func (*SSHMessage) NextLayer

func (s *SSHMessage) NextLayer() Layer

func (*SSHMessage) Parse

func (s *SSHMessage) Parse(data []byte) error

func (*SSHMessage) String

func (s *SSHMessage) String() string

func (*SSHMessage) Summary

func (s *SSHMessage) Summary() string

type ServerName added in v0.0.3

type ServerName struct {
	Type         uint16
	Length       uint16
	SNListLength uint16
	SNType       uint8
	SNNameLength uint16
	SNName       string
}

func (*ServerName) Parse added in v0.0.3

func (sn *ServerName) Parse(data []byte) error

func (*ServerName) String added in v0.0.3

func (sn *ServerName) String() string

type SvcParam added in v0.0.13

type SvcParam struct {
	Key    *SvcParamKey `json:"svc-param-key"`
	Length uint16       `json:"svc-param-value-length"`
	Value  []byte       `json:"svc-param-value"` // TODO: add proper parsing
}

func (*SvcParam) MarshalBinary added in v0.0.24

func (sp *SvcParam) MarshalBinary() ([]byte, error)

func (*SvcParam) String added in v0.0.13

func (sp *SvcParam) String() string

func (*SvcParam) ToBytes added in v0.0.24

func (sp *SvcParam) ToBytes() []byte

type SvcParamKey added in v0.0.13

type SvcParamKey struct {
	Val  uint16 `json:"val"`
	Desc string `json:"desc"`
}

func (*SvcParamKey) String added in v0.0.13

func (spk *SvcParamKey) String() string

type TCPFlag added in v0.0.6

type TCPFlag struct {
	Val  uint8
	Desc string
}

type TCPFlags

type TCPFlags struct {
	Raw uint8
	Val []*TCPFlag
}

func (*TCPFlags) String

func (t *TCPFlags) String() string

type TCPSegment

type TCPSegment struct {
	SrcPort uint16 // Identifies the sending port.
	DstPort uint16 // Identifies the receiving port.
	// If the SYN flag is set (1), then this is the initial sequence number. The sequence number of the actual
	// first data byte and the acknowledged number in the corresponding ACK are then this sequence number plus 1.
	// If the SYN flag is unset (0), then this is the accumulated sequence number of the first data byte of this
	// segment for the current session.
	SeqNumber uint32
	// If the ACK flag is set, the value is the next sequence number that the sender of the ACK is expecting.
	AckNumber  uint32
	DataOffset uint8     // 4 bits specifies the size of the TCP header in 32-bit words.
	Reserved   uint8     // 4 bits reserved for future use and should be set to zero.
	Flags      *TCPFlags // Contains 8 1-bit flags (control bits)
	// The size of the receive window, which specifies the number of window size units[b] that the sender of
	// this segment is currently willing to receive.
	WindowSize uint16
	// The 16-bit checksum field is used for error-checking of the TCP header, the payload and an IP pseudo-header.
	Checksum uint16
	// If the URG flag is set, then this 16-bit field is an offset from the sequence number
	// indicating the last urgent data byte.
	UrgentPointer uint16
	Options       []byte // The length of this field is determined by the data offset field.
	Payload       []byte
}

TCP protocol is described in RFC 761.

func (*TCPSegment) Name added in v0.0.13

func (t *TCPSegment) Name() LayerName

func (*TCPSegment) NextLayer

func (t *TCPSegment) NextLayer() Layer

func (*TCPSegment) Parse

func (t *TCPSegment) Parse(data []byte) error

Parse parses the given byte data into a TCPSegment struct.

func (*TCPSegment) String

func (t *TCPSegment) String() string

func (*TCPSegment) Summary

func (t *TCPSegment) Summary() string

type TLSClientHello added in v0.0.3

type TLSClientHello struct {
	Type               uint8
	TypeDesc           string
	Length             int // 3 bytes int(uint(b[2]) | uint(b[1])<<8 | uint(b[0])<<16))
	Version            *TLSVersion
	Random             []byte // 32 bytes
	SessionIDLength    uint8  // if 0 no session follows
	SessionID          string
	CipherSuitesLength uint16
	CipherSuites       []*CipherSuite
	CmprMethodsLength  uint8  // usually 0x01
	CmprMethods        []byte // usually 0x00
	ExtensionLength    uint16
	Extensions         []*Extension
	ServerName         *ServerName
	ALPN               []string
}

https://wiki.osdev.org/TLS_Handshake#Client_Hello_Message

func (*TLSClientHello) MarshalJSON added in v0.0.4

func (tch *TLSClientHello) MarshalJSON() ([]byte, error)

func (*TLSClientHello) ParseHS added in v0.0.3

func (tch *TLSClientHello) ParseHS(data []byte) error

func (*TLSClientHello) String added in v0.0.3

func (tch *TLSClientHello) String() string

type TLSClientHelloRequest added in v0.0.4

type TLSClientHelloRequest struct {
	SNI          string   `json:"sni,omitempty"`
	Type         string   `json:"type,omitempty"`
	Version      string   `json:"version,omitempty"`
	SessionID    string   `json:"session_id,omitempty"`
	CipherSuites []string `json:"cipher_suites,omitempty"`
	Extensions   []string `json:"extensions,omitempty"`
	ALPN         []string `json:"alpn,omitempty"`
}

type TLSClientHelloRequestWrapper added in v0.0.4

type TLSClientHelloRequestWrapper struct {
	Request TLSClientHelloRequest `json:"tls_request"`
}

type TLSMessage

type TLSMessage struct {
	Records []*Record
	Data    []byte
}

port 443 https://tls12.xargs.org/#client-hello/annotated https://tls13.xargs.org/#client-hello/annotated https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-5

func (*TLSMessage) Name added in v0.0.13

func (t *TLSMessage) Name() LayerName

func (*TLSMessage) NextLayer

func (t *TLSMessage) NextLayer() Layer

func (*TLSMessage) Parse

func (t *TLSMessage) Parse(data []byte) error

func (*TLSMessage) String

func (t *TLSMessage) String() string

func (*TLSMessage) Summary

func (t *TLSMessage) Summary() string

type TLSServerHello added in v0.0.3

type TLSServerHello struct {
	Type             uint8
	TypeDesc         string
	Length           int // 3 bytes int(uint(b[2]) | uint(b[1])<<8 | uint(b[0])<<16))
	Version          *TLSVersion
	Random           []byte // 32 bytes
	SessionIDLength  uint8  // if 0 no session follows
	SessionID        string
	CipherSuite      *CipherSuite
	CmprMethod       uint8
	ExtensionLength  uint16
	Extensions       []*Extension
	SupportedVersion *TLSVersion
}

https://wiki.osdev.org/TLS_Handshake#Server_Hello_Message

func (*TLSServerHello) MarshalJSON added in v0.0.4

func (tsh *TLSServerHello) MarshalJSON() ([]byte, error)

func (*TLSServerHello) ParseHS added in v0.0.3

func (tsh *TLSServerHello) ParseHS(data []byte) error

func (*TLSServerHello) String added in v0.0.3

func (tsh *TLSServerHello) String() string

type TLSServerHelloResponse added in v0.0.4

type TLSServerHelloResponse struct {
	Type             string   `json:"type,omitempty"`
	Version          string   `json:"version,omitempty"`
	SessionID        string   `json:"session_id,omitempty"`
	CipherSuite      string   `json:"cipher_suite,omitempty"`
	Extensions       []string `json:"extensions,omitempty"`
	SupportedVersion string   `json:"supported_version,omitempty"`
}

type TLSServerHelloResponseWrapper added in v0.0.4

type TLSServerHelloResponseWrapper struct {
	Response TLSServerHelloResponse `json:"tls_response"`
}

type TLSVersion added in v0.0.3

type TLSVersion struct {
	Val  uint16
	Desc string
}

func (*TLSVersion) String added in v0.0.3

func (tv *TLSVersion) String() string

type TLVOpt added in v0.0.23

type TLVOpt interface {
	Type() IPv6ExtHdrOptType
	MarshalBinary() ([]byte, error)
	ToBytes() []byte
}

type TrafficClass

type TrafficClass struct {
	Raw      uint8
	DSCP     uint8
	DSCPDesc string
	ECN      uint8
}

func NewTrafficClass added in v0.0.21

func NewTrafficClass(tc uint8) *TrafficClass

func (*TrafficClass) String

func (p *TrafficClass) String() string

type UDPSegment

type UDPSegment struct {
	// UDP protocol is defined in RFC 768.
	SrcPort   uint16 // Identifies the sending port.
	DstPort   uint16 // Identifies the receiving port.
	UDPLength uint16 // Specifies the length in bytes of the UDP header and UDP data.
	Checksum  uint16 // The checksum field may be used for error-checking of the header and data.
	Payload   []byte
}

func NewUDPSegment added in v0.0.9

func NewUDPSegment(srcPort, dstPort uint16, payload []byte) (*UDPSegment, error)

func (*UDPSegment) MarshalBinary added in v0.0.9

func (u *UDPSegment) MarshalBinary() ([]byte, error)

func (*UDPSegment) Name added in v0.0.13

func (u *UDPSegment) Name() LayerName

func (*UDPSegment) NextLayer

func (u *UDPSegment) NextLayer() Layer

func (*UDPSegment) Parse

func (u *UDPSegment) Parse(data []byte) error

Parse parses the given byte data into a UDPSegment struct.

func (*UDPSegment) SetChecksum added in v0.0.13

func (u *UDPSegment) SetChecksum(pseudo []byte) error

func (*UDPSegment) String

func (u *UDPSegment) String() string

func (*UDPSegment) Summary

func (u *UDPSegment) Summary() string

func (*UDPSegment) ToBytes added in v0.0.9

func (u *UDPSegment) ToBytes() []byte

func (*UDPSegment) UnmarshalBinary added in v0.0.9

func (u *UDPSegment) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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