safing-portmaster/status/get.go
2019-01-29 16:20:06 +01:00

46 lines
1.1 KiB
Go

package status
import (
"sync/atomic"
)
var (
activeSecurityLevel *uint32
selectedSecurityLevel *uint32
portmasterStatus *uint32
gate17Status *uint32
)
func init() {
var (
activeSecurityLevelValue uint32
selectedSecurityLevelValue uint32
portmasterStatusValue uint32
gate17StatusValue uint32
)
activeSecurityLevel = &activeSecurityLevelValue
selectedSecurityLevel = &selectedSecurityLevelValue
portmasterStatus = &portmasterStatusValue
gate17Status = &gate17StatusValue
}
// ActiveSecurityLevel returns the current security level.
func ActiveSecurityLevel() uint8 {
return uint8(atomic.LoadUint32(activeSecurityLevel))
}
// SelectedSecurityLevel returns the selected security level.
func SelectedSecurityLevel() uint8 {
return uint8(atomic.LoadUint32(selectedSecurityLevel))
}
// PortmasterStatus returns the current Portmaster status.
func PortmasterStatus() uint8 {
return uint8(atomic.LoadUint32(portmasterStatus))
}
// Gate17Status returns the current Gate17 status.
func Gate17Status() uint8 {
return uint8(atomic.LoadUint32(gate17Status))
}