mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Move all filter/interception config to interception module
This commit is contained in:
parent
084a1a2654
commit
59392e41c6
3 changed files with 17 additions and 27 deletions
|
@ -1,8 +1,10 @@
|
|||
package firewall
|
||||
|
||||
import (
|
||||
"github.com/safing/portbase/api"
|
||||
"github.com/safing/portbase/config"
|
||||
"github.com/safing/portbase/notifications"
|
||||
"github.com/safing/portmaster/core"
|
||||
"github.com/safing/spn/captain"
|
||||
)
|
||||
|
||||
|
@ -107,13 +109,22 @@ func registerConfig() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Config variables for interception and filter module.
|
||||
// Everything is registered by the interception module, as the filter module
|
||||
// can be disabled.
|
||||
var (
|
||||
devMode config.BoolOption
|
||||
apiListenAddress config.StringOption
|
||||
|
||||
filterEnabled config.BoolOption
|
||||
tunnelEnabled config.BoolOption
|
||||
useCommunityNodes config.BoolOption
|
||||
)
|
||||
|
||||
func getConfig() {
|
||||
devMode = config.Concurrent.GetAsBool(core.CfgDevModeKey, false)
|
||||
apiListenAddress = config.GetAsString(api.CfgDefaultListenAddressKey, "")
|
||||
|
||||
filterEnabled = config.Concurrent.GetAsBool(CfgOptionEnableFilterKey, true)
|
||||
tunnelEnabled = config.Concurrent.GetAsBool(captain.CfgOptionEnableSPNKey, false)
|
||||
useCommunityNodes = config.Concurrent.GetAsBool(captain.CfgOptionUseCommunityNodesKey, true)
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
var filterModule *modules.Module
|
||||
|
||||
func init() {
|
||||
filterModule = modules.Register("filter", filterPrep, filterStart, nil, "core", "intel")
|
||||
filterModule = modules.Register("filter", nil, nil, nil, "core", "interception", "intel")
|
||||
subsystems.Register(
|
||||
"filter",
|
||||
"Privacy Filter",
|
||||
|
@ -31,18 +31,3 @@ func init() {
|
|||
},
|
||||
)
|
||||
}
|
||||
|
||||
func filterPrep() (err error) {
|
||||
err = registerConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func filterStart() error {
|
||||
getConfig()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -13,12 +13,9 @@ import (
|
|||
"github.com/tevino/abool"
|
||||
"golang.org/x/sync/singleflight"
|
||||
|
||||
"github.com/safing/portbase/api"
|
||||
"github.com/safing/portbase/config"
|
||||
"github.com/safing/portbase/log"
|
||||
"github.com/safing/portbase/modules"
|
||||
"github.com/safing/portmaster/compat"
|
||||
"github.com/safing/portmaster/core"
|
||||
_ "github.com/safing/portmaster/core/base"
|
||||
"github.com/safing/portmaster/firewall/inspection"
|
||||
"github.com/safing/portmaster/firewall/interception"
|
||||
|
@ -46,12 +43,6 @@ var (
|
|||
ownPID = os.Getpid()
|
||||
)
|
||||
|
||||
// Config variables for interception module.
|
||||
var (
|
||||
devMode config.BoolOption
|
||||
apiListenAddress config.StringOption
|
||||
)
|
||||
|
||||
func init() {
|
||||
// TODO: Move interception module to own package (dir).
|
||||
interceptionModule = modules.Register("interception", interceptionPrep, interceptionStart, interceptionStop, "base", "updates", "network", "notifications")
|
||||
|
@ -60,12 +51,15 @@ func init() {
|
|||
}
|
||||
|
||||
func interceptionPrep() error {
|
||||
if err := registerConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return prepAPIAuth()
|
||||
}
|
||||
|
||||
func interceptionStart() error {
|
||||
devMode = config.Concurrent.GetAsBool(core.CfgDevModeKey, false)
|
||||
apiListenAddress = config.GetAsString(api.CfgDefaultListenAddressKey, "")
|
||||
getConfig()
|
||||
|
||||
if err := registerMetrics(); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Reference in a new issue