github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/tcp/const.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package tcp
     4  
     5  import (
     6  	"../timer"
     7  )
     8  
     9  // ATTENTION:::: Don't changed below settings without any good reason
    10  // https://man7.org/linux/man-pages/man7/tcp.7.html
    11  const (
    12  	// default congestion-control algorithm to be used for new tcp sockets
    13  	CongestionControlAlgorithm = "reno"
    14  
    15  	// negative of TCP_QUICKACK in linux which will disable the "Nagle" algorithm
    16  	DelayedAcknowledgment        = true
    17  	DelayedAcknowledgmentTimeout = 500 * timer.Millisecond
    18  	// NoDelay controls whether the operating system should delay
    19  	// packet transmission in hopes of sending fewer packets (Nagle's
    20  	// algorithm).  The default is true (no delay), meaning that data is
    21  	// sent as soon as possible after a Write.
    22  	NoDelay = true // TODO::: need it in user-space??
    23  
    24  	// keep-alive message means send ACK to peer to force OS and
    25  	// any NAT mechanism in network layer to keep open the tcp stream in their routing tables.
    26  	KeepAlive_Message = true
    27  
    28  	// The number of seconds between TCP keep-alive probes.
    29  	KeepAlive_Interval = 75
    30  	// The maximum number of TCP keep-alive probes to send before giving up and
    31  	// killing the connection if no response is obtained from the other end.
    32  	KeepAlive_Probes = 9
    33  	// The time (in seconds) the connection needs to remain idle before TCP starts sending keepalive probes.
    34  	// terminated after approximately an additional 11 minutes (9 probes an interval of 75 seconds apart)
    35  	KeepAlive_Idle = 7200 // seconds (2 hours)
    36  
    37  	// Linger sets the behavior of Close on a connection which still
    38  	// has data waiting to be sent or to be acknowledged.
    39  	//
    40  	// If sec < 0 (the default), the operating system finishes sending the
    41  	// data in the background.
    42  	//
    43  	// If sec == 0, the operating system discards any unsent or
    44  	// unacknowledged data.
    45  	//
    46  	// If sec > 0, the data is sent in the background as with sec < 0. On
    47  	// some operating systems after sec seconds have elapsed any remaining
    48  	// unsent data may be discarded.
    49  	Linger = -1
    50  )
    51  
    52  // ATTENTION:::: Don't changed below settings without any good reason
    53  const (
    54  	MinPacketLen      = 20 // 5words * 4bit
    55  	OptionDefault_MSS = 536
    56  )