Browse Source

fix port and protocol types

abhishek9686 9 months ago
parent
commit
2c854ecb29
2 changed files with 7 additions and 7 deletions
  1. 3 3
      logic/acls.go
  2. 4 4
      models/acl.go

+ 3 - 3
logic/acls.go

@@ -684,7 +684,7 @@ func GetAclRulesForNode(node *models.Node) (rules map[string]models.AclRule) {
 			defaultPolicy.ID: {
 				IPList:           []net.IPNet{node.NetworkRange},
 				IP6List:          []net.IPNet{node.NetworkRange6},
-				AllowedProtocols: []models.Protocol{models.ALL},
+				AllowedProtocols: models.ALL,
 				Direction:        models.TrafficDirectionBi,
 				Allowed:          true,
 			},
@@ -717,7 +717,7 @@ func GetAclRulesForNode(node *models.Node) (rules map[string]models.AclRule) {
 						acl.ID: {
 							IPList:           []net.IPNet{node.NetworkRange},
 							IP6List:          []net.IPNet{node.NetworkRange6},
-							AllowedProtocols: []models.Protocol{models.ALL},
+							AllowedProtocols: models.ALL,
 							AllowedPorts:     acl.Port,
 							Direction:        acl.AllowedDirection,
 							Allowed:          true,
@@ -729,7 +729,7 @@ func GetAclRulesForNode(node *models.Node) (rules map[string]models.AclRule) {
 						acl.ID: {
 							IPList:           []net.IPNet{node.NetworkRange},
 							IP6List:          []net.IPNet{node.NetworkRange6},
-							AllowedProtocols: []models.Protocol{models.ALL},
+							AllowedProtocols: models.ALL,
 							AllowedPorts:     acl.Port,
 							Direction:        acl.AllowedDirection,
 							Allowed:          true,

+ 4 - 4
models/acl.go

@@ -70,8 +70,8 @@ type Acl struct {
 	RuleType         AclPolicyType           `json:"policy_type"`
 	Src              []AclPolicyTag          `json:"src_type"`
 	Dst              []AclPolicyTag          `json:"dst_type"`
-	Proto            []Protocol              `json:"protocol"` // tcp, udp, etc.
-	Port             []int                   `json:"ports"`
+	Proto            Protocol                `json:"protocol"` // tcp, udp, etc.
+	Port             []string                `json:"ports"`
 	AllowedDirection AllowedTrafficDirection `json:"allowed_traffic_direction"`
 	Enabled          bool                    `json:"enabled"`
 	CreatedBy        string                  `json:"created_by"`
@@ -96,8 +96,8 @@ type AclRule struct {
 	ID               string                  `json:"id"`
 	IPList           []net.IPNet             `json:"ip_list"`
 	IP6List          []net.IPNet             `json:"ip6_list"`
-	AllowedProtocols []Protocol              `json:"allowed_protocols"` // tcp, udp, etc.
-	AllowedPorts     []int                   `json:"allowed_ports"`
+	AllowedProtocols Protocol                `json:"allowed_protocols"` // tcp, udp, etc.
+	AllowedPorts     []string                `json:"allowed_ports"`
 	Direction        AllowedTrafficDirection `json:"direction"` // single or two-way
 	Allowed          bool
 }