Fix process linter errors

This commit is contained in:
Daniel
2020-04-10 13:19:17 +02:00
parent c20c73a2d8
commit bb778f2cf7
9 changed files with 28 additions and 16 deletions

View File

@@ -178,7 +178,7 @@ func GetUDP6PacketInfo(localIP net.IP, localPort uint16, remoteIP net.IP, remote
return -1, pktDirection, nil 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() lock.RLock()
defer lock.RUnlock() defer lock.RUnlock()

View File

@@ -37,7 +37,7 @@ func New() (*IPHelper, error) {
// load dll // load dll
new.dll = windows.NewLazySystemDLL("iphlpapi.dll") new.dll = windows.NewLazySystemDLL("iphlpapi.dll")
new.dll.Load() err = new.dll.Load()
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@@ -59,14 +59,14 @@ type iphelperTCP6Table struct {
type iphelperTCP6Row struct { type iphelperTCP6Row struct {
// docs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366896(v=vs.85).aspx // docs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366896(v=vs.85).aspx
localAddr [16]byte localAddr [16]byte
localScopeID uint32 _ uint32 // localScopeID
localPort uint32 localPort uint32
remoteAddr [16]byte remoteAddr [16]byte
remoteScopeID uint32 _ uint32 // remoteScopeID
remotePort uint32 remotePort uint32
state uint32 state uint32
owningPid uint32 owningPid uint32
} }
type iphelperUDPTable struct { type iphelperUDPTable struct {
@@ -90,10 +90,10 @@ type iphelperUDP6Table struct {
type iphelperUDP6Row struct { type iphelperUDP6Row struct {
// docs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366923(v=vs.85).aspx // docs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366923(v=vs.85).aspx
localAddr [16]byte localAddr [16]byte
localScopeID uint32 _ uint32 // localScopeID
localPort uint32 localPort uint32
owningPid uint32 owningPid uint32
} }
// IP and Protocol constants // IP and Protocol constants
@@ -137,7 +137,7 @@ func increaseBufSize() int {
defer bufSizeLock.Unlock() defer bufSizeLock.Unlock()
// increase // increase
bufSize = bufSize * 2 bufSize *= 2
// not too much // not too much
if bufSize > 65536 { if bufSize > 65536 {
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. // 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 // docs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365928(v=vs.85).aspx
if !ipHelper.valid.IsSet() { if !ipHelper.valid.IsSet() {

View File

@@ -1,3 +1,5 @@
// +build linux
package proc package proc
import ( import (

View File

@@ -1,3 +1,5 @@
// +build linux
package proc package proc
import ( import (

View File

@@ -1,3 +1,5 @@
// +build linux
package proc package proc
import ( import (

View File

@@ -1,3 +1,5 @@
// +build linux
package proc package proc
import ( import (

View File

@@ -1,3 +1,5 @@
// +build linux
package proc package proc
import ( import (

View File

@@ -1,3 +1,5 @@
// +build linux
package proc package proc
import ( import (