Implement review suggestions

This commit is contained in:
Daniel
2020-05-19 16:57:55 +02:00
parent 65a3456165
commit e65ae8b55d
14 changed files with 130 additions and 100 deletions

View File

@@ -24,10 +24,6 @@ import (
// - switch direction to outbound if outbound packet is seen?
// - IP: Unidentified Process
const (
UnidentifiedProcessID = -1
)
// Errors
var (
ErrConnectionNotFound = errors.New("could not find connection in system state tables")
@@ -75,7 +71,7 @@ func Lookup(pktInfo *packet.Info) (pid int, inbound bool, err error) {
return searchUDP(udp6Binds, udp6States, updateUDP6Table, pktInfo)
default:
return UnidentifiedProcessID, false, errors.New("unsupported protocol for finding process")
return socket.UnidentifiedProcessID, false, errors.New("unsupported protocol for finding process")
}
}
@@ -119,7 +115,7 @@ func searchTCP(
connections, listeners = updateTables()
}
return UnidentifiedProcessID, false, ErrConnectionNotFound
return socket.UnidentifiedProcessID, false, ErrConnectionNotFound
}
func searchUDP(
@@ -170,5 +166,5 @@ func searchUDP(
binds = updateTable()
}
return UnidentifiedProcessID, pktInfo.Inbound, ErrConnectionNotFound
return socket.UnidentifiedProcessID, pktInfo.Inbound, ErrConnectionNotFound
}