Add logic layer for the ACL firewall rules management.

This commit is contained in:
Givi Khojanashvili
2023-03-17 19:02:54 +04:00
parent 9ab2fd1340
commit 64bf7699e6
7 changed files with 166 additions and 12 deletions

View File

@@ -8,6 +8,7 @@ import (
"html/template"
"strings"
"github.com/netbirdio/netbird/management/proto"
"github.com/netbirdio/netbird/management/server/activity"
"github.com/netbirdio/netbird/management/server/status"
@@ -449,3 +450,17 @@ func (am *DefaultAccountManager) savePolicy(account *Account, policy *Policy) (e
}
return
}
func toProtocolFirewallRules(update []*FirewallRule) []*proto.FirewallRule {
result := make([]*proto.FirewallRule, len(update))
for i := range update {
result[i] = &proto.FirewallRule{
PeerID: update[i].PeerID,
PeerIP: update[i].PeerIP,
Direction: update[i].Direction,
Port: update[i].Port,
Action: update[i].Action,
}
}
return result
}