github.com/sagernet/netlink@v0.0.0-20240612041022-b9a21c07ac6a/tcp.go (about)

     1  package netlink
     2  
     3  // TCP States
     4  const (
     5  	TCP_ESTABLISHED = iota + 0x01
     6  	TCP_SYN_SENT
     7  	TCP_SYN_RECV
     8  	TCP_FIN_WAIT1
     9  	TCP_FIN_WAIT2
    10  	TCP_TIME_WAIT
    11  	TCP_CLOSE
    12  	TCP_CLOSE_WAIT
    13  	TCP_LAST_ACK
    14  	TCP_LISTEN
    15  	TCP_CLOSING
    16  	TCP_NEW_SYN_REC
    17  	TCP_MAX_STATES
    18  )
    19  
    20  type TCPInfo struct {
    21  	State                     uint8
    22  	Ca_state                  uint8
    23  	Retransmits               uint8
    24  	Probes                    uint8
    25  	Backoff                   uint8
    26  	Options                   uint8
    27  	Snd_wscale                uint8 // no uint4
    28  	Rcv_wscale                uint8
    29  	Delivery_rate_app_limited uint8
    30  	Fastopen_client_fail      uint8
    31  	Rto                       uint32
    32  	Ato                       uint32
    33  	Snd_mss                   uint32
    34  	Rcv_mss                   uint32
    35  	Unacked                   uint32
    36  	Sacked                    uint32
    37  	Lost                      uint32
    38  	Retrans                   uint32
    39  	Fackets                   uint32
    40  	Last_data_sent            uint32
    41  	Last_ack_sent             uint32
    42  	Last_data_recv            uint32
    43  	Last_ack_recv             uint32
    44  	Pmtu                      uint32
    45  	Rcv_ssthresh              uint32
    46  	Rtt                       uint32
    47  	Rttvar                    uint32
    48  	Snd_ssthresh              uint32
    49  	Snd_cwnd                  uint32
    50  	Advmss                    uint32
    51  	Reordering                uint32
    52  	Rcv_rtt                   uint32
    53  	Rcv_space                 uint32
    54  	Total_retrans             uint32
    55  	Pacing_rate               uint64
    56  	Max_pacing_rate           uint64
    57  	Bytes_acked               uint64 /* RFC4898 tcpEStatsAppHCThruOctetsAcked */
    58  	Bytes_received            uint64 /* RFC4898 tcpEStatsAppHCThruOctetsReceived */
    59  	Segs_out                  uint32 /* RFC4898 tcpEStatsPerfSegsOut */
    60  	Segs_in                   uint32 /* RFC4898 tcpEStatsPerfSegsIn */
    61  	Notsent_bytes             uint32
    62  	Min_rtt                   uint32
    63  	Data_segs_in              uint32 /* RFC4898 tcpEStatsDataSegsIn */
    64  	Data_segs_out             uint32 /* RFC4898 tcpEStatsDataSegsOut */
    65  	Delivery_rate             uint64
    66  	Busy_time                 uint64 /* Time (usec) busy sending data */
    67  	Rwnd_limited              uint64 /* Time (usec) limited by receive window */
    68  	Sndbuf_limited            uint64 /* Time (usec) limited by send buffer */
    69  	Delivered                 uint32
    70  	Delivered_ce              uint32
    71  	Bytes_sent                uint64 /* RFC4898 tcpEStatsPerfHCDataOctetsOut */
    72  	Bytes_retrans             uint64 /* RFC4898 tcpEStatsPerfOctetsRetrans */
    73  	Dsack_dups                uint32 /* RFC4898 tcpEStatsStackDSACKDups */
    74  	Reord_seen                uint32 /* reordering events seen */
    75  	Rcv_ooopack               uint32 /* Out-of-order packets received */
    76  	Snd_wnd                   uint32 /* peer's advertised receive window after * scaling (bytes) */
    77  }
    78  
    79  type TCPBBRInfo struct {
    80  	BBRBW         uint64
    81  	BBRMinRTT     uint32
    82  	BBRPacingGain uint32
    83  	BBRCwndGain   uint32
    84  }