Update app profile icons. Switch to new portbase options
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
package status
|
||||
|
||||
// Definitions of Security and Status Levels.
|
||||
const (
|
||||
SecurityLevelOff uint8 = 0
|
||||
import (
|
||||
"github.com/safing/portbase/config"
|
||||
)
|
||||
|
||||
// DisplayHintSecurityLevel is an external option hint for security levels.
|
||||
// It's meant to be used as a value for config.DisplayHintAnnotation.
|
||||
const DisplayHintSecurityLevel string = "security level"
|
||||
|
||||
// Security levels
|
||||
const (
|
||||
SecurityLevelOff uint8 = 0
|
||||
SecurityLevelNormal uint8 = 1
|
||||
SecurityLevelHigh uint8 = 2
|
||||
SecurityLevelExtreme uint8 = 4
|
||||
@@ -12,7 +19,36 @@ const (
|
||||
SecurityLevelsNormalAndExtreme uint8 = SecurityLevelNormal | SecurityLevelExtreme
|
||||
SecurityLevelsHighAndExtreme uint8 = SecurityLevelHigh | SecurityLevelExtreme
|
||||
SecurityLevelsAll uint8 = SecurityLevelNormal | SecurityLevelHigh | SecurityLevelExtreme
|
||||
)
|
||||
|
||||
// SecurityLevelValues defines all possible security levels.
|
||||
var SecurityLevelValues = []config.PossibleValue{
|
||||
{
|
||||
Name: "Normal",
|
||||
Value: SecurityLevelsAll,
|
||||
},
|
||||
{
|
||||
Name: "High",
|
||||
Value: SecurityLevelsHighAndExtreme,
|
||||
},
|
||||
{
|
||||
Name: "Extreme",
|
||||
Value: SecurityLevelExtreme,
|
||||
},
|
||||
}
|
||||
|
||||
// AllSecurityLevelValues is like SecurityLevelValues but also includes Off.
|
||||
var AllSecurityLevelValues = append([]config.PossibleValue{
|
||||
{
|
||||
Name: "Off",
|
||||
Value: SecurityLevelOff,
|
||||
},
|
||||
},
|
||||
SecurityLevelValues...,
|
||||
)
|
||||
|
||||
// Status constants
|
||||
const (
|
||||
StatusOff uint8 = 0
|
||||
StatusError uint8 = 1
|
||||
StatusWarning uint8 = 2
|
||||
|
||||
@@ -5,20 +5,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
activeSecurityLevel *uint32
|
||||
selectedSecurityLevel *uint32
|
||||
activeSecurityLevel = new(uint32)
|
||||
selectedSecurityLevel = new(uint32)
|
||||
)
|
||||
|
||||
func init() {
|
||||
var (
|
||||
activeSecurityLevelValue uint32
|
||||
selectedSecurityLevelValue uint32
|
||||
)
|
||||
|
||||
activeSecurityLevel = &activeSecurityLevelValue
|
||||
selectedSecurityLevel = &selectedSecurityLevelValue
|
||||
}
|
||||
|
||||
// ActiveSecurityLevel returns the current security level.
|
||||
func ActiveSecurityLevel() uint8 {
|
||||
return uint8(atomic.LoadUint32(activeSecurityLevel))
|
||||
|
||||
Reference in New Issue
Block a user