Implement review suggestions
This commit is contained in:
@@ -41,7 +41,7 @@ type Connection struct { //nolint:maligned // TODO: fix alignment
|
||||
VerdictPermanent bool
|
||||
Inspecting bool
|
||||
Encrypted bool // TODO
|
||||
Hidden bool
|
||||
Internal bool // Portmaster internal connections are marked in order to easily filter these out in the UI
|
||||
|
||||
pktQueue chan packet.Packet
|
||||
firewallHandler FirewallHandler
|
||||
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/safing/portmaster/process"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -16,6 +18,9 @@ var (
|
||||
|
||||
// duration after which DNS requests without a following connection are logged
|
||||
openDNSRequestLimit = 3 * time.Second
|
||||
|
||||
// scope prefix
|
||||
unidentifiedProcessScopePrefix = strconv.Itoa(process.UnidentifiedProcessID) + "/"
|
||||
)
|
||||
|
||||
func removeOpenDNSRequest(pid int, fqdn string) {
|
||||
@@ -26,12 +31,9 @@ func removeOpenDNSRequest(pid int, fqdn string) {
|
||||
_, ok := openDNSRequests[key]
|
||||
if ok {
|
||||
delete(openDNSRequests, key)
|
||||
return
|
||||
}
|
||||
|
||||
// check if there is an open dns request from an unidentified process
|
||||
if pid >= 0 {
|
||||
delete(openDNSRequests, "-1/"+fqdn)
|
||||
} else if pid != process.UnidentifiedProcessID {
|
||||
// check if there is an open dns request from an unidentified process
|
||||
delete(openDNSRequests, unidentifiedProcessScopePrefix+fqdn)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user