tcp

package
v0.0.0-...-968416b Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolName   = "tcp"
	ProtocolNumber = header.TCPProtocolNumber

	DefaultBufferSize = 1 << 20 // 1MB 接收或发送缓存的默认值

)
View Source
const (
	InitialCwnd = 10 // 初始拥塞窗口大小

)
View Source
const (
	MaxSACKBlocks = 6 // 接收端存储的最大SACK块数。
)

Variables

View Source
var (
	// SynRcvdCountThreshold 在TCP使用 SYN cookies接受连接之前,允许的最大的处于 SYN-RCVD 状态的数量
	SynRcvdCountThreshold uint64 = 1000
)

Functions

func FindWndScale

func FindWndScale(wnd seqnum.Size) int

FindWndScale 对于给定的最大窗口大小,确定窗口扩展因子 因为窗口的大小不能超过序列号范围的一半,即窗口最大2^30, so (2^16)*(2^maxWnsScale) < 2^30, get maxWnsScale = 14

func TrimSACKBlockList

func TrimSACKBlockList(sack *SACKInfo, rcvNxt seqnum.Value)

TrimSACKBlockList tcp的可靠性:通过删除/修改 start为 <rcvNxt 的任何块来更新sack块列表。

func UpdateSACKBlocks

func UpdateSACKBlocks(sack *SACKInfo, segStart seqnum.Value, segEnd seqnum.Value, rcvNxt seqnum.Value)

UpdateSACKBlocks tcp的可靠性:更新SACK块列表以包含 segStart-segEnd 指定的段,只有没有被消费掉的seg才会被用来更新sack。 如果该段恰好是无序传递,那么sack.blocks中的第一个块总是包括由 segStart-segEnd 标识的段。

Types

type AvailableCongestionControlOption

type AvailableCongestionControlOption string // 返回支持的拥塞控制算法

type CongestionControlOption

type CongestionControlOption string // 设置当前的拥塞控制算法

type ReceiveBufferSizeOption

type ReceiveBufferSizeOption struct {
	Min     int
	Default int
	Max     int
}

type SACKEnabled

type SACKEnabled bool // 开启SACK功能

type SACKInfo

type SACKInfo struct {
	Blocks    [MaxSACKBlocks]header.SACKBlock
	NumBlocks int // 有效blocks的数量
}

SACKInfo 持有给定端点的TCP SACK信息

type SendBufferSizeOption

type SendBufferSizeOption struct {
	Min     int
	Default int
	Max     int
}

Jump to

Keyboard shortcuts

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