Improve status module

This commit is contained in:
Daniel
2019-01-29 16:20:06 +01:00
parent e8b5cedc9d
commit 321f3feec5
13 changed files with 342 additions and 107 deletions

View File

@@ -5,32 +5,29 @@ import (
)
var (
currentSecurityLevel *uint32
activeSecurityLevel *uint32
selectedSecurityLevel *uint32
threatLevel *uint32
portmasterStatus *uint32
gate17Status *uint32
)
func init() {
var (
currentSecurityLevelValue uint32
activeSecurityLevelValue uint32
selectedSecurityLevelValue uint32
threatLevelValue uint32
portmasterStatusValue uint32
gate17StatusValue uint32
)
currentSecurityLevel = &currentSecurityLevelValue
activeSecurityLevel = &activeSecurityLevelValue
selectedSecurityLevel = &selectedSecurityLevelValue
threatLevel = &threatLevelValue
portmasterStatus = &portmasterStatusValue
gate17Status = &gate17StatusValue
}
// CurrentSecurityLevel returns the current security level.
func CurrentSecurityLevel() uint8 {
return uint8(atomic.LoadUint32(currentSecurityLevel))
// ActiveSecurityLevel returns the current security level.
func ActiveSecurityLevel() uint8 {
return uint8(atomic.LoadUint32(activeSecurityLevel))
}
// SelectedSecurityLevel returns the selected security level.
@@ -38,11 +35,6 @@ func SelectedSecurityLevel() uint8 {
return uint8(atomic.LoadUint32(selectedSecurityLevel))
}
// ThreatLevel returns the current threat level.
func ThreatLevel() uint8 {
return uint8(atomic.LoadUint32(threatLevel))
}
// PortmasterStatus returns the current Portmaster status.
func PortmasterStatus() uint8 {
return uint8(atomic.LoadUint32(portmasterStatus))