Documentation
¶
Overview ¶
Provides encoding and decoding for IPv4 packets.
Index ¶
- Constants
- func CalculateChecksum(raw_bytes []byte, csum uint32) uint16
- func ProtocolToType(proto Protocol) packet.Type
- type Flags
- 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
- type Protocol
Constants ¶
View Source
const ( Evil Flags = 1 << 2 /* RFC3514 */ DontFragment = 1 << 1 MoreFragments = 1 << 0 )
View Source
const ( None Protocol = 0x00 GRE = 0x2F ICMPv4 = 0x01 ICMPv6 = 0x3A IGMP = 0x02 IPSecAH = 0x33 IPSecESP = 0x32 IPv6 = 0x29 ISIS = 0x7C L2TP = 0x73 OSPF = 0x59 SCTP = 0x84 TCP = 0x06 UDP = 0x11 UDPLite = 0x88 )
Variables ¶
This section is empty.
Functions ¶
func CalculateChecksum ¶
func ProtocolToType ¶
Create a new Type from the given IP protocol ID.
Types ¶
type Packet ¶
type Packet struct { Version uint8 IHL uint8 TOS uint8 `cmp:"skip"` Length uint16 `cmp:"skip"` Id uint16 Flags Flags FragOff uint16 TTL uint8 `cmp:"skip"` Protocol Protocol `string:"proto"` Checksum uint16 `cmp:"skip" string:"sum"` SrcAddr net.IP `string:"src"` DstAddr net.IP `string:"dst"` // contains filtered or unexported fields }
func (*Packet) GuessPayloadType ¶
func (*Packet) InitChecksum ¶
Click to show internal directories.
Click to hide internal directories.