diff --git a/process/iphelper/get.go b/process/iphelper/get.go index 78c6bb12..99c0f821 100644 --- a/process/iphelper/get.go +++ b/process/iphelper/get.go @@ -178,7 +178,7 @@ func GetUDP6PacketInfo(localIP net.IP, localPort uint16, remoteIP net.IP, remote return -1, pktDirection, nil } -func search(connections, listeners []*ConnectionEntry, localIP, remoteIP net.IP, localPort, remotePort uint16, pktDirection bool) (pid int, direction bool) { +func search(connections, listeners []*ConnectionEntry, localIP, remoteIP net.IP, localPort, remotePort uint16, pktDirection bool) (pid int, direction bool) { //nolint:unparam // TODO: use direction, it may not be used because results caused problems, investigate. lock.RLock() defer lock.RUnlock() diff --git a/process/iphelper/iphelper.go b/process/iphelper/iphelper.go index f4799fe9..a7c259da 100644 --- a/process/iphelper/iphelper.go +++ b/process/iphelper/iphelper.go @@ -37,7 +37,7 @@ func New() (*IPHelper, error) { // load dll new.dll = windows.NewLazySystemDLL("iphlpapi.dll") - new.dll.Load() + err = new.dll.Load() if err != nil { return nil, err } diff --git a/process/iphelper/tables.go b/process/iphelper/tables.go index d80ab0c5..8ffecfd7 100644 --- a/process/iphelper/tables.go +++ b/process/iphelper/tables.go @@ -59,14 +59,14 @@ type iphelperTCP6Table struct { type iphelperTCP6Row struct { // docs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366896(v=vs.85).aspx - localAddr [16]byte - localScopeID uint32 - localPort uint32 - remoteAddr [16]byte - remoteScopeID uint32 - remotePort uint32 - state uint32 - owningPid uint32 + localAddr [16]byte + _ uint32 // localScopeID + localPort uint32 + remoteAddr [16]byte + _ uint32 // remoteScopeID + remotePort uint32 + state uint32 + owningPid uint32 } type iphelperUDPTable struct { @@ -90,10 +90,10 @@ type iphelperUDP6Table struct { type iphelperUDP6Row struct { // docs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366923(v=vs.85).aspx - localAddr [16]byte - localScopeID uint32 - localPort uint32 - owningPid uint32 + localAddr [16]byte + _ uint32 // localScopeID + localPort uint32 + owningPid uint32 } // IP and Protocol constants @@ -137,7 +137,7 @@ func increaseBufSize() int { defer bufSizeLock.Unlock() // increase - bufSize = bufSize * 2 + bufSize *= 2 // not too much if bufSize > 65536 { bufSize = 65536 @@ -149,7 +149,7 @@ func increaseBufSize() int { } // GetTables returns the current connection state table of Windows of the given protocol and IP version. -func (ipHelper *IPHelper) GetTables(protocol uint8, ipVersion uint8) (connections []*ConnectionEntry, listeners []*ConnectionEntry, err error) { +func (ipHelper *IPHelper) GetTables(protocol uint8, ipVersion uint8) (connections []*ConnectionEntry, listeners []*ConnectionEntry, err error) { //nolint:gocognit,gocycle // TODO // docs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365928(v=vs.85).aspx if !ipHelper.valid.IsSet() { diff --git a/process/proc/gather.go b/process/proc/gather.go index a912b958..436b0bb2 100644 --- a/process/proc/gather.go +++ b/process/proc/gather.go @@ -1,3 +1,5 @@ +// +build linux + package proc import ( diff --git a/process/proc/get.go b/process/proc/get.go index 1fe68940..dec27e23 100644 --- a/process/proc/get.go +++ b/process/proc/get.go @@ -1,3 +1,5 @@ +// +build linux + package proc import ( diff --git a/process/proc/processfinder.go b/process/proc/processfinder.go index f6f57408..5ee1bb4b 100644 --- a/process/proc/processfinder.go +++ b/process/proc/processfinder.go @@ -1,3 +1,5 @@ +// +build linux + package proc import ( diff --git a/process/proc/processfinder_test.go b/process/proc/processfinder_test.go index 30df4483..16d3d181 100644 --- a/process/proc/processfinder_test.go +++ b/process/proc/processfinder_test.go @@ -1,3 +1,5 @@ +// +build linux + package proc import ( diff --git a/process/proc/sockets.go b/process/proc/sockets.go index 49027119..c82b078c 100644 --- a/process/proc/sockets.go +++ b/process/proc/sockets.go @@ -1,3 +1,5 @@ +// +build linux + package proc import ( diff --git a/process/proc/sockets_test.go b/process/proc/sockets_test.go index 71574ffe..44e8fd34 100644 --- a/process/proc/sockets_test.go +++ b/process/proc/sockets_test.go @@ -1,3 +1,5 @@ +// +build linux + package proc import (