Documentation ¶
Overview ¶
Package tcpinfo implements encoding and decoding of TCP-level socket options regarding connection information.
The Transmission Control Protocol (TCP) is defined in RFC 793. TCP Selective Acknowledgment Options is defined in RFC 2018. Management Information Base for the Transmission Control Protocol (TCP) is defined in RFC 4022. TCP Congestion Control is defined in RFC 5681. Computing TCP's Retransmission Timer is described in RFC 6298. TCP Options and Maximum Segment Size (MSS) is defined in RFC 6691. Shared Use of Experimental TCP Options is defined in RFC 6994. TCP Extensions for High Performance is defined in RFC 7323.
Example:
import ( "github.com/mikioh/tcp" "github.com/mikioh/tcpinfo" ) c, err := net.Dial("tcp", "golang.org:80") if err != nil { // error handling } defer c.Close() tc, err := tcp.NewConn(c) if err != nil { // error handling } var o tcpinfo.Info var b [256]byte i, err := tc.Option(o.Level(), o.Name(), b[:]) if err != nil { // error handling } txt, err := json.Marshal(i) if err != nil { // error handling } fmt.Println(txt)
Index ¶
Constants ¶
View Source
const ( TCP_INFO = 0xb SizeofTCPInfo = 0x90 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TCPInfo ¶
type TCPInfo struct { State uint8 Ca_state uint8 Retransmits uint8 Probes uint8 Backoff uint8 Options uint8 Pad_cgo_0 [2]byte Rto uint32 Ato uint32 Snd_mss uint32 Rcv_mss uint32 Unacked uint32 Sacked uint32 Lost uint32 Retrans uint32 Fackets uint32 Last_data_sent uint32 Last_ack_sent uint32 Last_data_recv uint32 Last_ack_recv uint32 Pmtu uint32 Rcv_ssthresh uint32 Rtt uint32 Rttvar uint32 Snd_ssthresh uint32 Snd_cwnd uint32 Advmss uint32 Reordering uint32 Rcv_rtt uint32 Rcv_space uint32 Total_retrans uint32 Pacing_rate uint64 Max_pacing_rate uint64 Bytes_acked uint64 Bytes_received uint64 Segs_out uint32 Segs_in uint32 }
Click to show internal directories.
Click to hide internal directories.