Documentation ¶
Overview ¶
Provides encoding and decoding for Ethernet (both EthernetII and 802.3) packets.
Index ¶
- Constants
- func EtherTypeToType(ethertype EtherType) packet.Type
- type EtherType
- type Packet
- func (p *Packet) Answers(other packet.Packet) bool
- func (p *Packet) Equals(other packet.Packet) bool
- func (p *Packet) GetLength() uint16
- func (p *Packet) GetType() packet.Type
- func (p *Packet) GuessPayloadType() packet.Type
- func (p *Packet) InitChecksum(csum uint32)
- func (p *Packet) Pack(buf *packet.Buffer) error
- func (p *Packet) Payload() packet.Packet
- func (p *Packet) SetPayload(pl packet.Packet) error
- func (p *Packet) String() string
- func (p *Packet) Unpack(buf *packet.Buffer) error
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 ¶
Create a new Type from the given EtherType.
Types ¶
type EtherType ¶
type EtherType uint16
func TypeToEtherType ¶
Convert the Type to the corresponding EtherType.
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 (*Packet) GuessPayloadType ¶
func (*Packet) InitChecksum ¶
Click to show internal directories.
Click to hide internal directories.