rename SearchBestSubnet to FindBestSubnet

This commit is contained in:
Adora Laura Kalb 2023-03-15 15:40:26 +01:00
parent 6154f16e11
commit 386a2bd33f

View file

@ -15,13 +15,13 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
) )
// SearchBestSubnet tries to load the most fitting IP subnet file // FindBestSubnet tries to load the most fitting IP subnet file
// on disk. It takes an IP object and tries to get the best subnet // on disk. It takes an IP object and tries to get the best subnet
// (meaning the subnet with the smallest subnet size). // (meaning the subnet with the smallest subnet size).
// //
// Returns the best subnet as Subnet object and true if a suitable // Returns the best subnet as Subnet object and true if a suitable
// subnet was found, otherwise an empty Subnet object and false. // subnet was found, otherwise an empty Subnet object and false.
func SearchBestSubnet(ip netip.Addr) (Subnet, bool) { func FindBestSubnet(ip netip.Addr) (Subnet, bool) {
subnets := ListSubnets() subnets := ListSubnets()
var smallestprefix int = 0 var smallestprefix int = 0
bestmatch, _ := netip.ParsePrefix("0.0.0.0/32") bestmatch, _ := netip.ParsePrefix("0.0.0.0/32")