mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
Rename security levels
This commit is contained in:
parent
bd7d08960e
commit
a425cb63d8
6 changed files with 37 additions and 37 deletions
|
@ -83,7 +83,7 @@ func (e *Entity) reverseResolve() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// TODO: security level
|
// TODO: security level
|
||||||
domain, err := reverseResolver(context.TODO(), e.IP.String(), status.SecurityLevelDynamic)
|
domain, err := reverseResolver(context.TODO(), e.IP.String(), status.SecurityLevelNormal)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("intel: failed to resolve IP %s: %s", e.IP, err)
|
log.Warningf("intel: failed to resolve IP %s: %s", e.IP, err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -4,14 +4,14 @@ package status
|
||||||
const (
|
const (
|
||||||
SecurityLevelOff uint8 = 0
|
SecurityLevelOff uint8 = 0
|
||||||
|
|
||||||
SecurityLevelDynamic uint8 = 1
|
SecurityLevelNormal uint8 = 1
|
||||||
SecurityLevelSecure uint8 = 2
|
SecurityLevelHigh uint8 = 2
|
||||||
SecurityLevelFortress uint8 = 4
|
SecurityLevelExtreme uint8 = 4
|
||||||
|
|
||||||
SecurityLevelsDynamicAndSecure uint8 = SecurityLevelDynamic | SecurityLevelSecure
|
SecurityLevelsNormalAndHigh uint8 = SecurityLevelNormal | SecurityLevelHigh
|
||||||
SecurityLevelsDynamicAndFortress uint8 = SecurityLevelDynamic | SecurityLevelFortress
|
SecurityLevelsNormalAndExtreme uint8 = SecurityLevelNormal | SecurityLevelExtreme
|
||||||
SecurityLevelsSecureAndFortress uint8 = SecurityLevelSecure | SecurityLevelFortress
|
SecurityLevelsHighAndExtreme uint8 = SecurityLevelHigh | SecurityLevelExtreme
|
||||||
SecurityLevelsAll uint8 = SecurityLevelDynamic | SecurityLevelSecure | SecurityLevelFortress
|
SecurityLevelsAll uint8 = SecurityLevelNormal | SecurityLevelHigh | SecurityLevelExtreme
|
||||||
|
|
||||||
StatusOff uint8 = 0
|
StatusOff uint8 = 0
|
||||||
StatusError uint8 = 1
|
StatusError uint8 = 1
|
||||||
|
|
|
@ -18,9 +18,9 @@ func (s *SystemStatus) autopilot() {
|
||||||
// update active security level
|
// update active security level
|
||||||
switch s.ThreatMitigationLevel {
|
switch s.ThreatMitigationLevel {
|
||||||
case SecurityLevelOff:
|
case SecurityLevelOff:
|
||||||
s.ActiveSecurityLevel = SecurityLevelDynamic
|
s.ActiveSecurityLevel = SecurityLevelNormal
|
||||||
atomicUpdateActiveSecurityLevel(SecurityLevelDynamic)
|
atomicUpdateActiveSecurityLevel(SecurityLevelNormal)
|
||||||
case SecurityLevelDynamic, SecurityLevelSecure, SecurityLevelFortress:
|
case SecurityLevelNormal, SecurityLevelHigh, SecurityLevelExtreme:
|
||||||
s.ActiveSecurityLevel = s.ThreatMitigationLevel
|
s.ActiveSecurityLevel = s.ThreatMitigationLevel
|
||||||
atomicUpdateActiveSecurityLevel(s.ThreatMitigationLevel)
|
atomicUpdateActiveSecurityLevel(s.ThreatMitigationLevel)
|
||||||
default:
|
default:
|
||||||
|
@ -31,7 +31,7 @@ func (s *SystemStatus) autopilot() {
|
||||||
// setSelectedSecurityLevel sets the selected security level.
|
// setSelectedSecurityLevel sets the selected security level.
|
||||||
func setSelectedSecurityLevel(level uint8) {
|
func setSelectedSecurityLevel(level uint8) {
|
||||||
switch level {
|
switch level {
|
||||||
case SecurityLevelOff, SecurityLevelDynamic, SecurityLevelSecure, SecurityLevelFortress:
|
case SecurityLevelOff, SecurityLevelNormal, SecurityLevelHigh, SecurityLevelExtreme:
|
||||||
status.Lock()
|
status.Lock()
|
||||||
defer status.Unlock()
|
defer status.Unlock()
|
||||||
|
|
||||||
|
|
|
@ -87,20 +87,20 @@ func FmtSecurityLevel(level uint8) string {
|
||||||
switch level {
|
switch level {
|
||||||
case SecurityLevelOff:
|
case SecurityLevelOff:
|
||||||
return "Off"
|
return "Off"
|
||||||
case SecurityLevelDynamic:
|
case SecurityLevelNormal:
|
||||||
return "Dynamic"
|
return "Normal"
|
||||||
case SecurityLevelSecure:
|
case SecurityLevelHigh:
|
||||||
return "Secure"
|
return "High"
|
||||||
case SecurityLevelFortress:
|
case SecurityLevelExtreme:
|
||||||
return "Fortress"
|
return "Extreme"
|
||||||
case SecurityLevelsDynamicAndSecure:
|
case SecurityLevelsNormalAndHigh:
|
||||||
return "Dynamic and Secure"
|
return "Normal and High"
|
||||||
case SecurityLevelsDynamicAndFortress:
|
case SecurityLevelsNormalAndExtreme:
|
||||||
return "Dynamic and Fortress"
|
return "Normal and Extreme"
|
||||||
case SecurityLevelsSecureAndFortress:
|
case SecurityLevelsHighAndExtreme:
|
||||||
return "Secure and Fortress"
|
return "High and Extreme"
|
||||||
case SecurityLevelsAll:
|
case SecurityLevelsAll:
|
||||||
return "Dynamic, Secure and Fortress"
|
return "Normal, High and Extreme"
|
||||||
default:
|
default:
|
||||||
return "INVALID"
|
return "INVALID"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,29 +5,29 @@ import "testing"
|
||||||
func TestStatus(t *testing.T) {
|
func TestStatus(t *testing.T) {
|
||||||
|
|
||||||
setSelectedSecurityLevel(SecurityLevelOff)
|
setSelectedSecurityLevel(SecurityLevelOff)
|
||||||
if FmtActiveSecurityLevel() != "Dynamic" {
|
if FmtActiveSecurityLevel() != "Normal" {
|
||||||
t.Errorf("unexpected string representation: %s", FmtActiveSecurityLevel())
|
t.Errorf("unexpected string representation: %s", FmtActiveSecurityLevel())
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectedSecurityLevel(SecurityLevelDynamic)
|
setSelectedSecurityLevel(SecurityLevelNormal)
|
||||||
AddOrUpdateThreat(&Threat{MitigationLevel: SecurityLevelSecure})
|
AddOrUpdateThreat(&Threat{MitigationLevel: SecurityLevelHigh})
|
||||||
if FmtActiveSecurityLevel() != "Dynamic*" {
|
if FmtActiveSecurityLevel() != "Normal*" {
|
||||||
t.Errorf("unexpected string representation: %s", FmtActiveSecurityLevel())
|
t.Errorf("unexpected string representation: %s", FmtActiveSecurityLevel())
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectedSecurityLevel(SecurityLevelSecure)
|
setSelectedSecurityLevel(SecurityLevelHigh)
|
||||||
if FmtActiveSecurityLevel() != "Secure" {
|
if FmtActiveSecurityLevel() != "High" {
|
||||||
t.Errorf("unexpected string representation: %s", FmtActiveSecurityLevel())
|
t.Errorf("unexpected string representation: %s", FmtActiveSecurityLevel())
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectedSecurityLevel(SecurityLevelSecure)
|
setSelectedSecurityLevel(SecurityLevelHigh)
|
||||||
AddOrUpdateThreat(&Threat{MitigationLevel: SecurityLevelFortress})
|
AddOrUpdateThreat(&Threat{MitigationLevel: SecurityLevelExtreme})
|
||||||
if FmtActiveSecurityLevel() != "Secure*" {
|
if FmtActiveSecurityLevel() != "High*" {
|
||||||
t.Errorf("unexpected string representation: %s", FmtActiveSecurityLevel())
|
t.Errorf("unexpected string representation: %s", FmtActiveSecurityLevel())
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectedSecurityLevel(SecurityLevelFortress)
|
setSelectedSecurityLevel(SecurityLevelExtreme)
|
||||||
if FmtActiveSecurityLevel() != "Fortress" {
|
if FmtActiveSecurityLevel() != "Extreme" {
|
||||||
t.Errorf("unexpected string representation: %s", FmtActiveSecurityLevel())
|
t.Errorf("unexpected string representation: %s", FmtActiveSecurityLevel())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ func (s *SystemStatus) updateThreatMitigationLevel() {
|
||||||
var mitigationLevel uint8
|
var mitigationLevel uint8
|
||||||
for _, threat := range s.Threats {
|
for _, threat := range s.Threats {
|
||||||
switch threat.MitigationLevel {
|
switch threat.MitigationLevel {
|
||||||
case SecurityLevelDynamic, SecurityLevelSecure, SecurityLevelFortress:
|
case SecurityLevelNormal, SecurityLevelHigh, SecurityLevelExtreme:
|
||||||
if threat.MitigationLevel > mitigationLevel {
|
if threat.MitigationLevel > mitigationLevel {
|
||||||
mitigationLevel = threat.MitigationLevel
|
mitigationLevel = threat.MitigationLevel
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue