Skip to content

Commit

Permalink
revert remove not used internal func
Browse files Browse the repository at this point in the history
  • Loading branch information
shireenf-ibm committed Jan 29, 2025
1 parent bca754a commit ca5ff8a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/netpol/internal/common/connectionset.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,26 @@ func (conn *ConnectionSet) Contains(port, protocol string) bool {
return false
}

// ContainedIn returns true if current ConnectionSet is contained in the input ConnectionSet object
func (conn *ConnectionSet) ContainedIn(other *ConnectionSet) bool {
if other.AllowAll {
return true
}
if conn.AllowAll {
return false
}
for protocol, ports := range conn.AllowedProtocols {
otherPorts, ok := other.AllowedProtocols[protocol]
if !ok {
return false
}
if !ports.ContainedIn(otherPorts) {
return false
}
}
return true
}

// AddConnection updates current ConnectionSet object with new allowed connection
func (conn *ConnectionSet) AddConnection(protocol v1.Protocol, ports *PortSet) {
if ports.IsEmpty() {
Expand Down

0 comments on commit ca5ff8a

Please sign in to comment.