mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-26 12:42:32 +02:00
cleanup
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
parent
db9f55d31a
commit
56f35628f4
@ -1055,7 +1055,7 @@ func (a *Account) connResourcesGenerator(ctx context.Context, targetPeer *nbpeer
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
rules = append(rules, expandPortsAndRanges(ctx, fr, rule, targetPeer)...)
|
rules = append(rules, expandPortsAndRanges(fr, rule, targetPeer)...)
|
||||||
}
|
}
|
||||||
}, func() ([]*nbpeer.Peer, []*FirewallRule) {
|
}, func() ([]*nbpeer.Peer, []*FirewallRule) {
|
||||||
return peers, rules
|
return peers, rules
|
||||||
@ -1586,7 +1586,7 @@ func (a *Account) AddAllGroup() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// expandPortsAndRanges expands Ports and PortRanges of a rule into individual firewall rules
|
// expandPortsAndRanges expands Ports and PortRanges of a rule into individual firewall rules
|
||||||
func expandPortsAndRanges(ctx context.Context, base FirewallRule, rule *PolicyRule, peer *nbpeer.Peer) []*FirewallRule {
|
func expandPortsAndRanges(base FirewallRule, rule *PolicyRule, peer *nbpeer.Peer) []*FirewallRule {
|
||||||
var expanded []*FirewallRule
|
var expanded []*FirewallRule
|
||||||
|
|
||||||
if len(rule.Ports) > 0 {
|
if len(rule.Ports) > 0 {
|
||||||
@ -1600,9 +1600,8 @@ func expandPortsAndRanges(ctx context.Context, base FirewallRule, rule *PolicyRu
|
|||||||
|
|
||||||
var peerSupportsPortRanges bool
|
var peerSupportsPortRanges bool
|
||||||
|
|
||||||
// skip processing the port ranges if the peer version doesn't support it
|
meetMinVer, err := posture.MeetsMinVersion(firewallRuleMinPortRangesVer, peer.Meta.WtVersion)
|
||||||
meetMin, err := posture.MeetsMinVersion(firewallRuleMinPortRangesVer, peer.Meta.WtVersion)
|
if err == nil && meetMinVer {
|
||||||
if err == nil && meetMin {
|
|
||||||
peerSupportsPortRanges = true
|
peerSupportsPortRanges = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1618,7 +1617,6 @@ func expandPortsAndRanges(ctx context.Context, base FirewallRule, rule *PolicyRu
|
|||||||
}
|
}
|
||||||
fr.Port = strconv.FormatUint(uint64(portRange.Start), 10)
|
fr.Port = strconv.FormatUint(uint64(portRange.Start), 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
expanded = append(expanded, &fr)
|
expanded = append(expanded, &fr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user