diff options
| author | Will Hawkins <[email protected]> | 2022-06-04 05:49:07 -0400 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2022-06-04 05:49:07 -0400 |
| commit | de7a7bf994a020049eca89098aab9d13ff81f361 (patch) | |
| tree | 25137addcf1ee9cc0c68c05d33481bcd050046ac /networkQuality.go | |
| parent | d38bea818a90a0ca2bfc17e96c00b9896e2c61ca (diff) | |
[Feature] Access TCP_INFO about underlying TCP connections
This will only work on *nix systems. Code that displays information
in this PR is only exemplary -- I am sure that there are better
places in the code to display it!
Diffstat (limited to 'networkQuality.go')
| -rw-r--r-- | networkQuality.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/networkQuality.go b/networkQuality.go index ab9517e..7593714 100644 --- a/networkQuality.go +++ b/networkQuality.go @@ -21,6 +21,7 @@ import ( "fmt" _ "io" _ "log" + "net" "net/http" "os" "runtime/pprof" @@ -323,6 +324,24 @@ func main() { continue } + if *debugCliFlag { + // Note: This code is just an example of how to use utilities.GetTCPInfo. + rawConn := downloadSaturation.LGCs[randomLGCsIndex].Stats().ConnInfo.Conn + tlsConn, ok := rawConn.(*tls.Conn) + if !ok { + fmt.Printf("OOPS: Could not get the TCP info for the connection (not a TLS connection)!\n") + } + tcpConn, ok := tlsConn.NetConn().(*net.TCPConn) + if !ok { + fmt.Printf("OOPS: Could not get the TCP info for the connection (not a TCP connection)!\n") + } + if info, err := utilities.GetTCPInfo(tcpConn); err != nil { + fmt.Printf("OOPS: Could not get the TCP info for the connection: %v!\n", err) + } else { + utilities.PrintTCPInfo(info) + } + } + unsaturatedMeasurementTransport := http2.Transport{} unsaturatedMeasurementTransport.TLSClientConfig = &tls.Config{} if sslKeyFileConcurrentWriter != nil { |
