Documentation
¶
Overview ¶
Package packet decodes layer two, three and four OSI model layers
Index ¶
Constants ¶
View Source
const ( // EtherTypeARP is Address Resolution Protocol EtherType value EtherTypeARP = 0x0806 // EtherTypeIPv4 is Internet Protocol version 4 EtherType value EtherTypeIPv4 = 0x0800 // EtherTypeIPv6 is Internet Protocol Version 6 EtherType value EtherTypeIPv6 = 0x86DD // EtherTypeLACP is Link Aggregation Control Protocol EtherType value EtherTypeLACP = 0x8809 // EtherTypeIEEE8021Q is VLAN-tagged frame (IEEE 802.1Q) EtherType value EtherTypeIEEE8021Q = 0x8100 )
View Source
const ( // IPv4HLen is IPv4 header length size IPv4HLen = 20 // IPv6HLen is IPv6 header length size IPv6HLen = 40 // IANAProtoICMP is IANA Internet Control Message number IANAProtoICMP = 1 // IANAProtoTCP is IANA Transmission Control number IANAProtoTCP = 6 // IANAProtoUDP is IANA User Datagram number IANAProtoUDP = 17 // IANAProtoIPv6ICMP is IANA Internet Control Message number for IPv6 IANAProtoIPv6ICMP = 58 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Datalink ¶
type Datalink struct {
// SrcMAC represents source MAC address
SrcMAC string
// DstMAC represents destination MAC address
DstMAC string
// Vlan represents VLAN value
Vlan int
// EtherType represents upper layer type value
EtherType uint16
}
Datalink represents layer two IEEE 802.11
type IPv4Header ¶
type IPv4Header struct {
Version int // protocol version
TOS int // type-of-service
TotalLen int // packet total length
ID int // identification
Flags int // flags
FragOff int // fragment offset
TTL int // time-to-live
Protocol int // next protocol
Checksum int // checksum
Src string // source address
Dst string // destination address
}
IPv4Header represents an IPv4 header
type IPv6Header ¶
type IPv6Header struct {
Version int // protocol version
TrafficClass int // traffic class
FlowLabel int // flow label
PayloadLen int // payload length
NextHeader int // next header
HopLimit int // hop limit
Src string // source address
Dst string // destination address
}
IPv6Header represents an IPv6 header
type Packet ¶
type Packet struct {
L2 Datalink
L3 interface{}
L4 interface{}
// contains filtered or unexported fields
}
Packet represents layer 2,3,4 available info
Click to show internal directories.
Click to hide internal directories.