package tcpinfo
Import Path
github.com/mikioh/tcpinfo (on go.dev)
Dependency Relation
imports 6 packages, and imported by one package
Involved Source Files
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.
NOTE: Older Linux kernels may not support extended TCP statistics
described in RFC 4898.
option.go
sys.go
sys_linux.go
tcp.go
zsys_2_6_10_linux.go
zsys_3_19_linux.go
zsys_linux.go
Code Examples
package main
import (
"encoding/json"
"fmt"
"log"
"net"
"github.com/mikioh/tcp"
"github.com/mikioh/tcpinfo"
)
func main() {
c, err := net.Dial("tcp", "golang.org:80")
if err != nil {
log.Fatal(err)
}
defer c.Close()
tc, err := tcp.NewConn(c)
if err != nil {
log.Fatal(err)
}
var o tcpinfo.Info
var b [256]byte
i, err := tc.Option(o.Level(), o.Name(), b[:])
if err != nil {
log.Fatal(err)
}
txt, err := json.Marshal(i)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(txt))
}
Package-Level Type Names (total 19)
A BBRInfo represents Bottleneck Bandwidth and Round-trip
propagation time-based congestion control information.
// congestion window gain shifted left 8 bits
// maximum-filtered bandwidth in bps
// minimum-filtered round-trip time
// pacing gain shifted left 8 bits
Algorithm implements the Algorithm method of CCAlgorithmInfo
interface.
*BBRInfo : CCAlgorithmInfo
A CAState represents a state of congestion avoidance.
( CAState) String() string
CAState : expvar.Var
CAState : fmt.Stringer
const CACWR
const CADisorder
const CALoss
const CAOpen
const CARecovery
A CCAlgorithm represents a name of congestion control algorithm.
Only supported on Linux.
Level implements the Level method of tcpopt.Option interface.
Marshal implements the Marshal method of tcpopt.Option interface.
Name implements the Name method of tcpopt.Option interface.
CCAlgorithm : github.com/mikioh/tcpopt.Option
CCAlgorithm : github.com/gogo/protobuf/proto.Marshaler
CCAlgorithm : github.com/golang/protobuf/proto.Marshaler
A CCAlgorithmInfo represents congestion control algorithm
information.
Only supported on Linux.
( CCAlgorithmInfo) Algorithm() string
*BBRInfo
*DCTCPInfo
*VegasInfo
func ParseCCAlgorithmInfo(name string, b []byte) (CCAlgorithmInfo, error)
A CCInfo represents raw information of congestion control
algorithm.
Only supported on Linux.
Raw []byte
Level implements the Level method of tcpopt.Option interface.
Marshal implements the Marshal method of tcpopt.Option interface.
Name implements the Name method of tcpopt.Option interface.
*CCInfo : github.com/mikioh/tcpopt.Option
*CCInfo : github.com/gogo/protobuf/proto.Marshaler
*CCInfo : github.com/golang/protobuf/proto.Marshaler
A CEState represents a state of ECN congestion encountered (CE)
codepoint.
A CongestionControl represents congestion control information.
// slow start threshold for receiver in bytes [Linux only]
// slow start threshold for sender in bytes or # of segments
// congestion window for sender in bytes [Darwin and FreeBSD]
// congestion window for sender in # of segments [Linux and NetBSD]
A DCTCPInfo represents Datacenter TCP congestion control
information.
// fraction of bytes sent
// state of ECN CE codepoint
// # of acked bytes with ECN
Enabled bool
// total # of acked bytes
Algorithm implements the Algorithm method of CCAlgorithmInfo
interface.
*DCTCPInfo : CCAlgorithmInfo
A FlowControl represents flow control information.
// advertised receiver window in bytes
An Info represents connection information.
Only supported on Darwin, FreeBSD, Linux and NetBSD.
// delayed acknowledgement timeout [Linux only]
// congestion control information
// flow control information
// since last ack received [Linux only]
// since last data received [FreeBSD and Linux]
// since last data sent [Linux only]
// requesting options
// options requested from peer
// retransmission timeout
// round-trip time
// round-trip time variation
// maximum segment size for receiver in bytes
// maximum segment size for sender in bytes
// connection state
// platform-specific information
Level implements the Level method of tcpopt.Option interface.
Marshal implements the Marshal method of tcpopt.Option interface.
MarshalJSON implements the MarshalJSON method of json.Marshaler
interface.
Name implements the Name method of tcpopt.Option interface.
*Info : github.com/mikioh/tcpopt.Option
*Info : github.com/goccy/go-json.Marshaler
*Info : github.com/gogo/protobuf/proto.Marshaler
*Info : github.com/golang/protobuf/proto.Marshaler
*Info : encoding/json.Marshaler
A MaxSegSize represents a maxiumum segment size option.
Kind returns an option kind field.
MaxSegSize : Option
An Option represents an option.
( Option) Kind() OptionKind
MaxSegSize
SACKPermitted
Timestamps
WindowScale
An OptionKind represents an option kind.
( OptionKind) String() string
OptionKind : expvar.Var
OptionKind : fmt.Stringer
func MaxSegSize.Kind() OptionKind
func Option.Kind() OptionKind
func SACKPermitted.Kind() OptionKind
func Timestamps.Kind() OptionKind
func WindowScale.Kind() OptionKind
const KindMaxSegSize
const KindSACKPermitted
const KindTimestamps
const KindWindowScale
A SACKPermitted reports whether a selective acknowledgment
permitted option is enabled.
Kind returns an option kind field.
SACKPermitted : Option
A State represents a state of connection.
( State) String() string
State : expvar.Var
State : fmt.Stringer
const Closed
const CloseWait
const Closing
const Established
const FinWait1
const FinWait2
const LastAck
const Listen
const SynReceived
const SynSent
const TimeWait
const Unknown
A SysInfo represents platform-specific information.
// advertised maximum segment size
// # of times retransmission backoff timer invoked
// state of congestion avoidance
// # of segments received containing a positive length data segment
// # of segments sent containing a positive length data segment
// # of forward ack segments in transmission queue
// # of lost segments
// current measured minimum RTT; zero means not available
// # of bytes not sent yet
// pacing rate
// path maximum transmission unit
// current RTT for receiver
// # of reordered segments allowed
// # of retransmitting segments in transmission queue
// # of retranmissions on timeout invoked
// # of sack'd segments
// # of segments received
// # of segments sent
// # of bytes for which cumulative acknowledgments have been received
// # of bytes for which cumulative acknowledgments have been sent
// # of retransmitted segments
// # of unack'd segments
// # of window or keep alive probes sent
A Timestamps reports whether a timestamps option is enabled.
Kind returns an option kind field.
Timestamps : Option
A VegasInfo represents Vegas congestion control information.
Enabled bool
// minimum round-trip time
// round-trip time
// # of round-trips
Algorithm implements the Algorithm method of CCAlgorithmInfo
interface.
*VegasInfo : CCAlgorithmInfo
A WindowScale represents a windows scale option.
Kind returns an option kind field.
WindowScale : Option
Package-Level Functions (only one)
ParseCCAlgorithmInfo parses congestion control algorithm
information.
Only supported on Linux.
Package-Level Constants (total 21)
const CADisorder CAState = 1 const CARecovery CAState = 3 const Established State = 5 const KindMaxSegSize OptionKind = 2 const KindSACKPermitted OptionKind = 4 const KindTimestamps OptionKind = 8 const KindWindowScale OptionKind = 3 const SynReceived State = 4![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |