package tcpconntrack
import "gvisor.dev/gvisor/pkg/tcpip/transport/tcpconntrack"
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 ¶
- type Result
- type TCB
- func (t *TCB) Init(initialSyn header.TCP, dataLen int) Result
- func (t *TCB) IsAlive() bool
- func (t *TCB) IsEmpty() bool
- func (t *TCB) OriginalSendSequenceNumber() seqnum.Value
- func (t *TCB) ReplySendSequenceNumber() seqnum.Value
- func (t *TCB) State() Result
- func (t *TCB) UpdateStateOriginal(tcp header.TCP, dataLen int) Result
- func (t *TCB) UpdateStateReply(tcp header.TCP, dataLen int) Result
Types ¶
type Result ¶
type Result int
Result is returned when the state of a TCB is updated in response to a 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 // ResultClosedByResponder indicates that the connection was gracefully // closed, and the reply stream was closed first. ResultClosedByResponder // ResultClosedByOriginator indicates that the connection was gracefully // closed, and the original stream was closed first. ResultClosedByOriginator )
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.
+stateify savable
func (*TCB) Init ¶
Init initializes the state of the TCB according to the initial SYN.
func (*TCB) IsAlive ¶
IsAlive returns true as long as the connection is established(Alive) or connecting state.
func (*TCB) IsEmpty ¶
IsEmpty returns true if tcb is not initialized.
func (*TCB) OriginalSendSequenceNumber ¶
OriginalSendSequenceNumber returns the snd.NXT for the original stream.
func (*TCB) ReplySendSequenceNumber ¶
ReplySendSequenceNumber returns the snd.NXT for the reply stream.
func (*TCB) State ¶
State returns the current state of the TCB.
func (*TCB) UpdateStateOriginal ¶
UpdateStateOriginal updates the state of the TCB based on the supplied original segment.
func (*TCB) UpdateStateReply ¶
UpdateStateReply updates the state of the TCB based on the supplied reply segment.
Source Files ¶
tcp_conntrack.go
- Version
- v0.0.0-20250515200445-d30c58e5b8a4 (latest)
- Published
- May 15, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 27 minutes ago –
Tools for package owners.