Add debug/core endpoint to add more Portmaster debug data
This commit is contained in:
@@ -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()),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -99,19 +99,19 @@ func SecurityLevelString(level uint8) string {
|
||||
case SecurityLevelOff:
|
||||
return "Off"
|
||||
case SecurityLevelNormal:
|
||||
return "Normal"
|
||||
return "Trusted"
|
||||
case SecurityLevelHigh:
|
||||
return "High"
|
||||
return "Untrusted"
|
||||
case SecurityLevelExtreme:
|
||||
return "Extreme"
|
||||
return "Danger"
|
||||
case SecurityLevelsNormalAndHigh:
|
||||
return "Normal and High"
|
||||
return "Trusted and Untrusted"
|
||||
case SecurityLevelsNormalAndExtreme:
|
||||
return "Normal and Extreme"
|
||||
return "Trusted and Danger"
|
||||
case SecurityLevelsHighAndExtreme:
|
||||
return "High and Extreme"
|
||||
return "Untrusted and Danger"
|
||||
case SecurityLevelsAll:
|
||||
return "Normal, High and Extreme"
|
||||
return "Trusted, Untrusted and Danger"
|
||||
default:
|
||||
return "INVALID"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user