tcp

package
v2.5.4-rc.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderLen = 20

HeaderLen is the length of a TCP header that doesn't have any options

View Source
const HeaderMaxLen = 60

Variables

This section is empty.

Functions

This section is empty.

Types

type Header []byte

Header represents a TCP header. The header is obtained by simply casting the IP header's payload.

func (Header) ACK

func (h Header) ACK() bool

func (Header) AckNumber

func (h Header) AckNumber() uint32

func (Header) AppendFlags

func (h Header) AppendFlags(b *bytes.Buffer)

AppendFlags appends a comma separated list of all flags that are currently set.

func (Header) CWR

func (h Header) CWR() bool

func (Header) Checksum

func (h Header) Checksum() uint16

func (Header) DataOffset

func (h Header) DataOffset() int

func (Header) DestinationPort

func (h Header) DestinationPort() uint16

func (Header) ECE

func (h Header) ECE() bool

func (Header) FIN

func (h Header) FIN() bool

func (Header) NS

func (h Header) NS() bool

func (Header) NoFlags

func (h Header) NoFlags() bool

func (Header) OptionBytes

func (h Header) OptionBytes() []byte

func (Header) PSH

func (h Header) PSH() bool

func (Header) Payload

func (h Header) Payload() []byte

func (Header) RST

func (h Header) RST() bool

func (Header) SYN

func (h Header) SYN() bool

func (Header) Sequence

func (h Header) Sequence() uint32

func (Header) SetACK

func (h Header) SetACK(flag bool)

func (Header) SetAckNumber

func (h Header) SetAckNumber(aq uint32)

func (Header) SetCWR

func (h Header) SetCWR(flag bool)

func (Header) SetChecksum

func (h Header) SetChecksum(ipHdr ip.Header)

func (Header) SetDataOffset

func (h Header) SetDataOffset(offset int)

func (Header) SetDestinationPort

func (h Header) SetDestinationPort(port uint16)

func (Header) SetECE

func (h Header) SetECE(flag bool)

func (Header) SetFIN

func (h Header) SetFIN(flag bool)

func (Header) SetNS

func (h Header) SetNS(flag bool)

func (Header) SetPSH

func (h Header) SetPSH(flag bool)

func (Header) SetRST

func (h Header) SetRST(flag bool)

func (Header) SetSYN

func (h Header) SetSYN(flag bool)

func (Header) SetSequence

func (h Header) SetSequence(sq uint32)

func (Header) SetSourcePort

func (h Header) SetSourcePort(port uint16)

func (Header) SetURG

func (h Header) SetURG(flag bool)

func (Header) SetUrgentPointer

func (h Header) SetUrgentPointer(up uint16)

func (Header) SetWindowSize

func (h Header) SetWindowSize(sz uint16)

func (Header) SourcePort

func (h Header) SourcePort() uint16

func (Header) URG

func (h Header) URG() bool

func (Header) UrgentPointer

func (h Header) UrgentPointer() uint16

func (Header) WindowSize

func (h Header) WindowSize() uint16

type Packet

type Packet interface {
	ip.Packet
	Header() Header
	PayloadLen() int
	Reset() Packet
}

func NewPacket

func NewPacket(ipPayloadLen int, src, dst net.IP, withAck bool) Packet

func PacketFromData

func PacketFromData(ipHdr ip.Header, data *buffer.Data) Packet

type PacketHandler

type PacketHandler interface {
	tunnel.Handler

	// HandlePacket handles a packet that was read from the TUN device
	HandlePacket(ctx context.Context, pkt Packet)
}

func NewHandler

func NewHandler(
	streamCreator StreamCreator,
	dispatcherClosing *int32,
	toTun ip.Writer,
	id tunnel.ConnID,
	remove func(),
	rndSource rand.Source,
) PacketHandler

type StreamCreator

type StreamCreator func(ctx context.Context) (tunnel.Stream, error)

Jump to

Keyboard shortcuts

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