tcpconntrack

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package tcpconntrack implements a TCP connection tracking object. It allows users with access to a segment stream to figure out when a connection is established, reset, and closed (and in the last case, who closed first).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result int

Result is returned when the state of a TCB is updated in response to an inbound or outbound segment.

const (
	// ResultDrop indicates that the segment should be dropped.
	ResultDrop Result = iota

	// ResultConnecting indicates that the connection remains in a
	// connecting state.
	ResultConnecting

	// ResultAlive indicates that the connection remains alive (connected).
	ResultAlive

	// ResultReset indicates that the connection was reset.
	ResultReset

	// ResultClosedByPeer indicates that the connection was gracefully
	// closed, and the inbound stream was closed first.
	ResultClosedByPeer

	// ResultClosedBySelf indicates that the connection was gracefully
	// closed, and the outbound stream was closed first.
	ResultClosedBySelf
)

type TCB

type TCB struct {
	// contains filtered or unexported fields
}

TCB is a TCP Control Block. It holds state necessary to keep track of a TCP connection and inform the caller when the connection has been closed.

func (*TCB) InboundSendSequenceNumber

func (t *TCB) InboundSendSequenceNumber() seqnum.Value

InboundSendSequenceNumber returns the snd.NXT for the inbound stream.

func (*TCB) Init

func (t *TCB) Init(initialSyn header.TCP) Result

Init initializes the state of the TCB according to the initial SYN.

func (*TCB) IsAlive

func (t *TCB) IsAlive() bool

IsAlive returns true as long as the connection is established(Alive) or connecting state.

func (*TCB) OutboundSendSequenceNumber

func (t *TCB) OutboundSendSequenceNumber() seqnum.Value

OutboundSendSequenceNumber returns the snd.NXT for the outbound stream.

func (*TCB) UpdateStateInbound

func (t *TCB) UpdateStateInbound(tcp header.TCP) Result

UpdateStateInbound updates the state of the TCB based on the supplied inbound segment.

func (*TCB) UpdateStateOutbound

func (t *TCB) UpdateStateOutbound(tcp header.TCP) Result

UpdateStateOutbound updates the state of the TCB based on the supplied outbound segment.

Jump to

Keyboard shortcuts

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