eth

package
v0.0.0-...-c97f47a Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 License: BSD-2-Clause Imports: 3 Imported by: 1

Documentation

Overview

Provides encoding and decoding for Ethernet (both EthernetII and 802.3) packets.

Index

Constants

View Source
const (
	None  EtherType = 0x0000
	ARP             = 0x0806
	IPv4            = 0x0800
	IPv6            = 0x86dd
	LLC             = 0x0001 /* pseudo ethertype */
	LLDP            = 0x088cc
	QinQ            = 0x88a8
	TRILL           = 0x22f3
	VLAN            = 0x8100
	WoL             = 0x0842
)

Variables

This section is empty.

Functions

func EtherTypeToType

func EtherTypeToType(ethertype EtherType) packet.Type

Create a new Type from the given EtherType.

Types

type EtherType

type EtherType uint16

func TypeToEtherType

func TypeToEtherType(pkttype packet.Type) EtherType

Convert the Type to the corresponding EtherType.

func (EtherType) String

func (t EtherType) String() string

type Packet

type Packet struct {
	DstAddr net.HardwareAddr `string:"dst"`
	SrcAddr net.HardwareAddr `string:"src"`
	Type    EtherType
	Length  uint16 `cmp:"skip"`
	// contains filtered or unexported fields
}

func Make

func Make() *Packet

func (*Packet) Answers

func (p *Packet) Answers(other packet.Packet) bool

func (*Packet) Equals

func (p *Packet) Equals(other packet.Packet) bool

func (*Packet) GetLength

func (p *Packet) GetLength() uint16

func (*Packet) GetType

func (p *Packet) GetType() packet.Type

func (*Packet) GuessPayloadType

func (p *Packet) GuessPayloadType() packet.Type

func (*Packet) InitChecksum

func (p *Packet) InitChecksum(csum uint32)

func (*Packet) Pack

func (p *Packet) Pack(buf *packet.Buffer) error

func (*Packet) Payload

func (p *Packet) Payload() packet.Packet

func (*Packet) SetPayload

func (p *Packet) SetPayload(pl packet.Packet) error

func (*Packet) String

func (p *Packet) String() string

func (*Packet) Unpack

func (p *Packet) Unpack(buf *packet.Buffer) error

Jump to

Keyboard shortcuts

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