Documentation ¶
Index ¶
- Constants
- Variables
- type Flag
- type Header
- func (hdr *Header) CalcChecksum(src, dest net.IP) uint16
- func (hdr *Header) HasFlag(flagBit Flag) bool
- func (t *Header) Marshal() ([]byte, error)
- func (hdr *Header) MarshalWithChecksum(src, dest net.IP) ([]byte, error)
- func (hdr *Header) String() string
- func (hdr *Header) Unmarshal(data []byte) error
- func (hdr *Header) UnmarshalWithChecksum(data []byte, src, dest net.IP) error
- type Option
- type TCPOptionKind
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 Header ¶
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 (*Header) MarshalWithChecksum ¶
func (*Header) Unmarshal ¶
why EOF on ubuntu with 22? https://github.com/google/gopacket/blob/master/layers/tcp.go<Paste>
type Option ¶
type Option struct { OptionType TCPOptionKind OptionLength uint8 OptionData []byte }
type TCPOptionKind ¶
type TCPOptionKind uint8
TCPOptionKind represents a TCP option code.
func (TCPOptionKind) String ¶
func (k TCPOptionKind) String() string
Click to show internal directories.
Click to hide internal directories.