- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for ShortestPrefixMatch (0.2 sec)
-
pkg/util/iptree/iptree_test.go
{"10.1.2.3/32", "10.0.0.0/8"}, } for _, test := range cases { m, _, ok := r.ShortestPrefixMatch(netip.MustParsePrefix(test.inp)) if !ok { t.Fatalf("no match: %v", test) } if m != netip.MustParsePrefix(test.out) { t.Fatalf("mis-match: %v %v", m, test) } } // not match _, _, ok := r.ShortestPrefixMatch(netip.MustParsePrefix("0.0.0.0/0")) if ok { t.Fatalf("match unexpected for 0.0.0.0/0")
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Tue Oct 31 21:05:04 UTC 2023 - 17.8K bytes - Viewed (0) -
pkg/util/iptree/iptree.go
} var zeroT T return netip.Prefix{}, zeroT, false } // ShortestPrefixMatch returns the shortest prefix match, the stored value and true if exist. // For example, considering the following prefixes 192.168.20.16/28 and 192.168.0.0/16, // when the address 192.168.20.19/32 is looked up it will return 192.168.0.0/16. func (t *Tree[T]) ShortestPrefixMatch(prefix netip.Prefix) (netip.Prefix, T, bool) { var zeroT T n := t.rootV4
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Tue Oct 31 21:05:04 UTC 2023 - 17.7K bytes - Viewed (0) -
pkg/registry/core/service/ipallocator/cidrallocator.go
address := ipToAddr(ip) prefix := netip.PrefixFrom(address, address.BitLen()) // Use the largest subnet to allocate addresses because // all the other subnets will be contained. _, allocator, ok := c.tree.ShortestPrefixMatch(prefix) if !ok { klog.V(2).Infof("Could not get allocator for IP %s", ip.String()) return nil, ErrMismatchedNetwork } return allocator, nil }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Sat May 04 18:33:12 UTC 2024 - 13.2K bytes - Viewed (0)