Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(header []byte) (EthernetHeader, IpHeader, ProtocolHeader)
Decode decodes an ethernet frame header and returns an IP header and a TCP or UDP header.
Types ¶
type EthernetHeader ¶
type EthernetHeader struct {
Source net.HardwareAddr
Destination net.HardwareAddr
VlanTag uint32
EtherType uint16
}
type Ipv4Header ¶
type Ipv4Header struct {
VersionAndHeaderLen uint8
Tos uint8
Len uint16
Id uint16
FragOff uint16
Ttl uint8
Protocol uint8
Checksum uint16
Source [4]byte
Destination [4]byte
}
func (Ipv4Header) IpVersion ¶
func (h Ipv4Header) IpVersion() int
type Ipv6Header ¶
type Ipv6Header struct {
VersionTrafficClassFlowLabel uint32
PayloadLength uint16
NextHeader uint8
HopLimit uint8
Source [16]byte
Destination [16]byte
}
func (Ipv6Header) IpVersion ¶
func (h Ipv6Header) IpVersion() int
type ProtocolHeader ¶
type ProtocolHeader interface {
Protocol() Protocol
}
Click to show internal directories.
Click to hide internal directories.
