Revamped verdict handling

This commit is contained in:
Patrick Pacher
2023-11-16 12:52:39 +01:00
parent f2839c274a
commit 923ce2aa24
13 changed files with 55 additions and 154 deletions

View File

@@ -139,8 +139,8 @@ func AddNetworkDebugData(di *debug.Info, profile, where string) {
debugConns []*Connection
accepted int
total int
transitioning int
)
for maybeConn := range it.Next {
// Switch to correct type.
conn, ok := maybeConn.(*Connection)
@@ -169,15 +169,13 @@ func AddNetworkDebugData(di *debug.Info, profile, where string) {
// Count.
total++
switch conn.Verdict.Firewall { //nolint:exhaustive
switch conn.Verdict { //nolint:exhaustive
case VerdictAccept,
VerdictRerouteToNameserver,
VerdictRerouteToTunnel:
accepted++
}
if conn.Verdict.Active != conn.Verdict.Firewall {
transitioning++
}
// Add to list.
debugConns = append(debugConns, conn)
@@ -186,10 +184,9 @@ func AddNetworkDebugData(di *debug.Info, profile, where string) {
// Add it all.
di.AddSection(
fmt.Sprintf(
"Network: %d/%d [~%d] Connections",
"Network: %d/%d Connections",
accepted,
total,
transitioning,
),
debug.UseCodeSection|debug.AddContentLineBreaks,
buildNetworkDebugInfoData(debugConns),