mirror of
https://github.com/juanfont/headscale.git
synced 2025-11-29 05:18:48 -05:00
replace netaddr usage with netip
This commit is contained in:
@@ -111,7 +111,7 @@ func (policy ACLPolicy) IsZero() bool {
|
||||
|
||||
// Returns the list of autoApproving namespaces, groups or tags for a given IPPrefix
|
||||
func (autoApprovers *AutoApprovers) GetRouteApprovers(
|
||||
prefix netaddr.IPPrefix,
|
||||
prefix netip.Prefix,
|
||||
) ([]string, error) {
|
||||
if prefix.Bits() == 0 {
|
||||
return autoApprovers.ExitNode, nil // 0.0.0.0/0, ::/0 or equivalent
|
||||
@@ -120,13 +120,14 @@ func (autoApprovers *AutoApprovers) GetRouteApprovers(
|
||||
approverAliases := []string{}
|
||||
|
||||
for autoApprovedPrefix, autoApproverAliases := range autoApprovers.Routes {
|
||||
autoApprovedPrefix, err := netaddr.ParseIPPrefix(autoApprovedPrefix)
|
||||
autoApprovedPrefix, err := netip.ParsePrefix(autoApprovedPrefix)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if autoApprovedPrefix.Bits() >= prefix.Bits() &&
|
||||
autoApprovedPrefix.Contains(prefix.IP()) {
|
||||
autoApprovedPrefix.Contains(prefix.Masked().Addr()) {
|
||||
approverAliases = append(approverAliases, autoApproverAliases...)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user