mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Fix layering of config that needs parsing
This commit is contained in:
parent
ad359da437
commit
6567345e8b
2 changed files with 9 additions and 2 deletions
|
@ -324,8 +324,8 @@ func (lp *LayeredProfile) MatchFilterLists(ctx context.Context, entity *intel.En
|
||||||
entity.EnableCNAMECheck(ctx, lp.FilterCNAMEs())
|
entity.EnableCNAMECheck(ctx, lp.FilterCNAMEs())
|
||||||
|
|
||||||
for _, layer := range lp.layers {
|
for _, layer := range lp.layers {
|
||||||
// search for the first layer that has filterListIDs set
|
// Search for the first layer that has filter lists set.
|
||||||
if len(layer.filterListIDs) > 0 {
|
if layer.filterListsSet {
|
||||||
entity.LoadLists(ctx)
|
entity.LoadLists(ctx)
|
||||||
|
|
||||||
if entity.MatchLists(layer.filterListIDs) {
|
if entity.MatchLists(layer.filterListIDs) {
|
||||||
|
|
|
@ -122,6 +122,7 @@ type Profile struct { //nolint:maligned // not worth the effort
|
||||||
defaultAction uint8
|
defaultAction uint8
|
||||||
endpoints endpoints.Endpoints
|
endpoints endpoints.Endpoints
|
||||||
serviceEndpoints endpoints.Endpoints
|
serviceEndpoints endpoints.Endpoints
|
||||||
|
filterListsSet bool
|
||||||
filterListIDs []string
|
filterListIDs []string
|
||||||
|
|
||||||
// Lifecycle Management
|
// Lifecycle Management
|
||||||
|
@ -152,6 +153,7 @@ func (profile *Profile) parseConfig() error {
|
||||||
var lastErr error
|
var lastErr error
|
||||||
|
|
||||||
action, ok := profile.configPerspective.GetAsString(CfgOptionDefaultActionKey)
|
action, ok := profile.configPerspective.GetAsString(CfgOptionDefaultActionKey)
|
||||||
|
profile.defaultAction = DefaultActionNotSet
|
||||||
if ok {
|
if ok {
|
||||||
switch action {
|
switch action {
|
||||||
case "permit":
|
case "permit":
|
||||||
|
@ -166,6 +168,7 @@ func (profile *Profile) parseConfig() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
list, ok := profile.configPerspective.GetAsStringArray(CfgOptionEndpointsKey)
|
list, ok := profile.configPerspective.GetAsStringArray(CfgOptionEndpointsKey)
|
||||||
|
profile.endpoints = nil
|
||||||
if ok {
|
if ok {
|
||||||
profile.endpoints, err = endpoints.ParseEndpoints(list)
|
profile.endpoints, err = endpoints.ParseEndpoints(list)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -174,6 +177,7 @@ func (profile *Profile) parseConfig() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
list, ok = profile.configPerspective.GetAsStringArray(CfgOptionServiceEndpointsKey)
|
list, ok = profile.configPerspective.GetAsStringArray(CfgOptionServiceEndpointsKey)
|
||||||
|
profile.serviceEndpoints = nil
|
||||||
if ok {
|
if ok {
|
||||||
profile.serviceEndpoints, err = endpoints.ParseEndpoints(list)
|
profile.serviceEndpoints, err = endpoints.ParseEndpoints(list)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -182,10 +186,13 @@ func (profile *Profile) parseConfig() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
list, ok = profile.configPerspective.GetAsStringArray(CfgOptionFilterListsKey)
|
list, ok = profile.configPerspective.GetAsStringArray(CfgOptionFilterListsKey)
|
||||||
|
profile.filterListsSet = false
|
||||||
if ok {
|
if ok {
|
||||||
profile.filterListIDs, err = filterlists.ResolveListIDs(list)
|
profile.filterListIDs, err = filterlists.ResolveListIDs(list)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
lastErr = err
|
lastErr = err
|
||||||
|
} else {
|
||||||
|
profile.filterListsSet = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue