Reevaluate and update firewall core logic
This commit is contained in:
@@ -18,16 +18,16 @@ func max(a, b uint8) uint8 {
|
||||
|
||||
// ConfigIsActive returns whether the given security level dependent config option is on or off.
|
||||
func ConfigIsActive(name string) SecurityLevelOption {
|
||||
activeAtLevel := config.GetAsInt(name, int64(SecurityLevelDynamic))
|
||||
activeAtLevel := config.GetAsInt(name, int64(SecurityLevelsAll))
|
||||
return func(minSecurityLevel uint8) bool {
|
||||
return uint8(activeAtLevel()) <= max(ActiveSecurityLevel(), minSecurityLevel)
|
||||
return uint8(activeAtLevel())&max(ActiveSecurityLevel(), minSecurityLevel) > 0
|
||||
}
|
||||
}
|
||||
|
||||
// ConfigIsActiveConcurrent returns whether the given security level dependent config option is on or off and is concurrency safe.
|
||||
func ConfigIsActiveConcurrent(name string) SecurityLevelOption {
|
||||
activeAtLevel := config.Concurrent.GetAsInt(name, int64(SecurityLevelDynamic))
|
||||
activeAtLevel := config.Concurrent.GetAsInt(name, int64(SecurityLevelsAll))
|
||||
return func(minSecurityLevel uint8) bool {
|
||||
return uint8(activeAtLevel()) <= max(ActiveSecurityLevel(), minSecurityLevel)
|
||||
return uint8(activeAtLevel())&max(ActiveSecurityLevel(), minSecurityLevel) > 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ import (
|
||||
"github.com/Safing/portbase/database"
|
||||
"github.com/Safing/portbase/log"
|
||||
"github.com/Safing/portbase/modules"
|
||||
|
||||
// module dependencies
|
||||
_ "github.com/Safing/portmaster/core"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -11,7 +14,7 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
modules.Register("status", nil, start, stop, "database")
|
||||
modules.Register("status", nil, start, stop, "core")
|
||||
}
|
||||
|
||||
func start() error {
|
||||
|
||||
Reference in New Issue
Block a user