tcp

package
v0.0.0-...-05965fc Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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
)

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 UnmarshalWithChecksum

func UnmarshalWithChecksum(data []byte, src, dest net.IP) (*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 (hdr *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   OptionKind
	OptionLength uint8
	OptionData   []byte
}

func (Option) String

func (t Option) String() string

type OptionKind

type OptionKind uint8

OptionKind represents a TCP option code.

func (OptionKind) String

func (k OptionKind) String() string

Jump to

Keyboard shortcuts

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