summaryrefslogtreecommitdiff
path: root/extendedstats/windows.go
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2022-06-22 15:10:07 -0400
committerWill Hawkins <[email protected]>2022-06-22 15:10:07 -0400
commit0609b02f82321577ba80cd368c6085fd0442f3f7 (patch)
tree782f966243f9d2dbcd328837a2cdf9ce5c1f948b /extendedstats/windows.go
parent8595ff279dc46e3f974661e29686af3de5e01026 (diff)
[Cleanup] Make long lines shorter and fix static fmt warnings
Besides running golines (for the first time in a while now that the tool supports generics), this commit removes punctuation and newlines from Errorf parameters -- something that gofmt does not like (I never knew!).
Diffstat (limited to 'extendedstats/windows.go')
-rw-r--r--extendedstats/windows.go20
1 files changed, 17 insertions, 3 deletions
diff --git a/extendedstats/windows.go b/extendedstats/windows.go
index cc2fca7..c1c80f8 100644
--- a/extendedstats/windows.go
+++ b/extendedstats/windows.go
@@ -70,11 +70,15 @@ type TCPINFO_V1 struct {
func (es *ExtendedStats) IncorporateConnectionStats(rawConn net.Conn) error {
tlsConn, ok := rawConn.(*tls.Conn)
if !ok {
- return fmt.Errorf("OOPS: Could not get the TCP info for the connection (not a TLS connection)")
+ return fmt.Errorf(
+ "OOPS: Could not get the TCP info for the connection (not a TLS connection)",
+ )
}
tcpConn, ok := tlsConn.NetConn().(*net.TCPConn)
if !ok {
- return fmt.Errorf("OOPS: Could not get the TCP info for the connection (not a TCP connection)")
+ return fmt.Errorf(
+ "OOPS: Could not get the TCP info for the connection (not a TCP connection)",
+ )
}
if info, err := getTCPInfo(tcpConn); err != nil {
return fmt.Errorf("OOPS: Could not get the TCP info for the connection: %v", err)
@@ -142,7 +146,17 @@ func getTCPInfo(connection net.Conn) (*TCPINFO_V1, error) {
completionRoutine := uintptr(0)
rawConn.Control(func(fd uintptr) {
- err = windows.WSAIoctl(windows.Handle(fd), iocc, (*byte)(unsafe.Pointer(&inbuf)), cbif, (*byte)(unsafe.Pointer(&outbuf)), cbob, &cbbr, &overlapped, completionRoutine)
+ err = windows.WSAIoctl(
+ windows.Handle(fd),
+ iocc,
+ (*byte)(unsafe.Pointer(&inbuf)),
+ cbif,
+ (*byte)(unsafe.Pointer(&outbuf)),
+ cbob,
+ &cbbr,
+ &overlapped,
+ completionRoutine,
+ )
})
return &outbuf, err
}