Documentation ¶
Overview ¶
Provides encoding and decoding for TCP packets.
Index ¶
- Constants
- type Flags
- type OptType
- type Option
- 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 ( Syn Flags = 1 << 1 Fin = 1 << 2 Rst = 1 << 3 PSH = 1 << 4 Ack = 1 << 5 Urg = 1 << 6 ECE = 1 << 7 Cwr = 1 << 8 NS = 1 << 9 )
View Source
const ( End OptType = 0x00 Nop = 0x01 MSS = 0x02 WindowScale = 0x03 SAckOk = 0x04 SAck = 0x05 Timestamp = 0x08 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Packet ¶
type Packet struct { SrcPort uint16 `string:"sport"` DstPort uint16 `string:"dport"` Seq uint32 Ack uint32 DataOff uint8 `string:"off"` Flags Flags WindowSize uint16 `string:"win"` Checksum uint16 `string:"sum"` Urgent uint16 `string:"urg"` Options []Option `cmp:"skip" string:"skip"` // contains filtered or unexported fields }
func (*Packet) GuessPayloadType ¶
func (*Packet) InitChecksum ¶
Click to show internal directories.
Click to hide internal directories.