tcp

package
v0.0.0-...-c97f47a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2020 License: BSD-2-Clause Imports: 3 Imported by: 1

Documentation

Overview

Provides encoding and decoding for TCP packets.

Index

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 Flags

type Flags uint16

func (Flags) String

func (f Flags) String() string

type OptType

type OptType uint8

type Option

type Option struct {
	Type OptType
	Len  uint8
	Data []byte
}

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 Make

func Make() *Packet

func (*Packet) Answers

func (p *Packet) Answers(other packet.Packet) bool

func (*Packet) Equals

func (p *Packet) Equals(other packet.Packet) bool

func (*Packet) GetLength

func (p *Packet) GetLength() uint16

func (*Packet) GetType

func (p *Packet) GetType() packet.Type

func (*Packet) GuessPayloadType

func (p *Packet) GuessPayloadType() packet.Type

func (*Packet) InitChecksum

func (p *Packet) InitChecksum(csum uint32)

func (*Packet) Pack

func (p *Packet) Pack(buf *packet.Buffer) error

func (*Packet) Payload

func (p *Packet) Payload() packet.Packet

func (*Packet) SetPayload

func (p *Packet) SetPayload(pl packet.Packet) error

func (*Packet) String

func (p *Packet) String() string

func (*Packet) Unpack

func (p *Packet) Unpack(buf *packet.Buffer) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL