Documentation
¶
Overview ¶
Package fixture serve as unittest sample for basic packet encode/decode
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EthernetII ¶
EthernetII ethernet frame
func (EthernetII) InstanceFor ¶
func (e EthernetII) InstanceFor(fieldname string) interface{}
InstanceFor return the Body struct pointer for conversion
type IPProtocol ¶
type IPProtocol uint8
IPProtocol protocol type
func (IPProtocol) String ¶
func (p IPProtocol) String() string
type IPv4 ¶
type IPv4 struct {
Version uint8 `packet:"length=4b"`
IHL uint8 `packet:"length=4b"`
DSCP uint8 `packet:"length=6b"`
ECN uint8 `packet:"length=2b"`
Length uint16
ID uint16
Flags IPv4Flag `packet:"length=3b"`
FragmentOffset uint16 `packet:"length=13b"`
TTL uint8
Protocol IPProtocol
Checksum Checksum
Source net.IP `packet:"length=4B"`
Dest net.IP `packet:"length=4B"`
Options []byte `packet:"lengthfor"`
Body interface{}
}
IPv4 packet
func (IPv4) InstanceFor ¶
InstanceFor returns the Body struct pointer for conversion
type Pcap ¶
type Pcap struct {
// contains filtered or unexported fields
}
Pcap helps with reading packet from pcap format
func (*Pcap) PacketData ¶
func (p *Pcap) PacketData() chan PacketData
PacketData use channel so it's possible to do range
type TCP ¶
type TCP struct {
Source Port
Dest Port
Sequence uint32
Ack uint32
DataOffset uint8 `packet:"length=4b"`
Flags TCPFlag `packet:"length=12b"`
WindowSize uint16
Checksum Checksum
UrgentPointer uint16
Options []byte `packet:"lengthfor"`
Body interface{}
}
TCP message
func (TCP) InstanceFor ¶
InstanceFor return the Body struct pointer for conversion
Click to show internal directories.
Click to hide internal directories.