tcp

package
v0.0.0-...-6781d13 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2016 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIN Flag = 1  // 00 0001
	SYN      = 2  // 00 0010
	RST      = 4  // 00 0100
	PSH      = 8  // 00 1000
	ACK      = 16 // 01 0000
	URG      = 32 // 10 0000
)
View Source
const (
	TCPOptionKindEndList                         = 0
	TCPOptionKindNop                             = 1
	TCPOptionKindMSS                             = 2  // len = 4
	TCPOptionKindWindowScale                     = 3  // len = 3
	TCPOptionKindSACKPermitted                   = 4  // len = 2
	TCPOptionKindSACK                            = 5  // len = n
	TCPOptionKindEcho                            = 6  // len = 6, obsolete
	TCPOptionKindEchoReply                       = 7  // len = 6, obsolete
	TCPOptionKindTimestamps                      = 8  // len = 10
	TCPOptionKindPartialOrderConnectionPermitted = 9  // len = 2, obsolete
	TCPOptionKindPartialOrderServiceProfile      = 10 // len = 3, obsolete
	TCPOptionKindCC                              = 11 // obsolete
	TCPOptionKindCCNew                           = 12 // obsolete
	TCPOptionKindCCEcho                          = 13 // obsolete
	TCPOptionKindAltChecksum                     = 14 // len = 3, obsolete
	TCPOptionKindAltChecksumData                 = 15 // len = n, obsolete
)

Variables

View Source
var ErrInvalidChecksum = fmt.Errorf("Invalid checksum")

Functions

This section is empty.

Types

type Flag

type Flag uint8
type Header struct {
	Source      uint16
	Destination uint16
	SeqNum      uint32
	AckNum      uint32
	DataOffset  uint8 // 4 bits
	Reserved    uint8 // 3 bits
	ECN         uint8 // 3 bits
	Ctrl        Flag  // 6 bits
	Window      uint16
	Checksum    uint16 // Kernel will set this if it's 0
	Urgent      uint16
	Options     []Option
	Padding     []byte
	Payload     []byte
	// contains filtered or unexported fields
}

func Parse

func Parse(data []byte) (Header, error)

func (*Header) CalcChecksum

func (hdr *Header) CalcChecksum(src, dest net.IP) uint16

func (*Header) HasFlag

func (hdr *Header) HasFlag(flagBit Flag) bool

func (*Header) Marshal

func (t *Header) Marshal() ([]byte, error)

func (*Header) MarshalWithChecksum

func (hdr *Header) MarshalWithChecksum(src, dest net.IP) ([]byte, error)

func (*Header) String

func (hdr *Header) String() string

func (*Header) Unmarshal

func (hdr *Header) Unmarshal(data []byte) error

why EOF on ubuntu with 22? https://github.com/google/gopacket/blob/master/layers/tcp.go<Paste>

func (*Header) UnmarshalWithChecksum

func (hdr *Header) UnmarshalWithChecksum(data []byte, src, dest net.IP) error

type Option

type Option struct {
	OptionType   TCPOptionKind
	OptionLength uint8
	OptionData   []byte
}

func (Option) String

func (t Option) String() string

type TCPOptionKind

type TCPOptionKind uint8

TCPOptionKind represents a TCP option code.

func (TCPOptionKind) String

func (k TCPOptionKind) String() string

Jump to

Keyboard shortcuts

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