refactor add filter acl

This commit is contained in:
Maycon Santos
2023-11-03 15:25:18 +01:00
parent e2f27502e4
commit b6af524187
5 changed files with 109 additions and 112 deletions

View File

@ -47,16 +47,7 @@ type Manager interface {
//
// If comment argument is empty firewall manager should set
// rule ID as comment for the rule
AddFiltering(
ip net.IP,
proto Protocol,
sPort *Port,
dPort *Port,
direction RuleDirection,
action Action,
ipsetName string,
comment string,
) (Rule, error)
AddFiltering(ruleRequest RuleRequest) ([]Rule, error)
// DeleteRule from the firewall by rule definition
DeleteRule(rule Rule) error
@ -69,3 +60,23 @@ type Manager interface {
// TODO: migrate routemanager firewal actions to this interface
}
// RuleRequest is the request to create a rule
type RuleRequest struct {
// IP is the IP address of the rule
IP net.IP
// Proto is the protocol of the rule
Proto Protocol
// SrcPort is the source port of the rule
SrcPort *Port
// DstPort is the destination port of the rule
DstPort *Port
// Direction is the direction of the rule
Direction RuleDirection
// Action is the action of the rule
Action Action
// IPSetName is the name of the IPSet
IPSetName string
// Comment is the comment of the rule
Comment string
}