Add debug/core endpoint to add more Portmaster debug data

This commit is contained in:
Daniel
2021-02-23 13:00:54 +01:00
parent 6c0df1155e
commit 0e51a9523a
4 changed files with 62 additions and 9 deletions

View File

@@ -2,8 +2,10 @@ package status
import (
"context"
"fmt"
"github.com/safing/portbase/modules"
"github.com/safing/portbase/utils/debug"
"github.com/safing/portmaster/netenv"
)
@@ -39,3 +41,16 @@ func start() error {
return nil
}
// AddToDebugInfo adds the system status to the given debug.Info.
func AddToDebugInfo(di *debug.Info) {
di.AddSection(
fmt.Sprintf("Status: %s", SecurityLevelString(ActiveSecurityLevel())),
debug.UseCodeSection|debug.AddContentLineBreaks,
fmt.Sprintf("ActiveSecurityLevel: %s", SecurityLevelString(ActiveSecurityLevel())),
fmt.Sprintf("SelectedSecurityLevel: %s", SecurityLevelString(SelectedSecurityLevel())),
fmt.Sprintf("ThreatMitigationLevel: %s", SecurityLevelString(getHighestMitigationLevel())),
fmt.Sprintf("CaptivePortal: %s", netenv.GetCaptivePortal().URL),
fmt.Sprintf("OnlineStatus: %s", netenv.GetOnlineStatus()),
)
}