Use x/net/route to manage routes directly (#1488)

This commit is contained in:
Nate Brown
2025-10-03 11:59:53 -04:00
committed by GitHub
parent b1f53d8d25
commit fb7f0c3657
3 changed files with 158 additions and 38 deletions

View File

@@ -1,6 +1,7 @@
package overlay
import (
"net"
"net/netip"
"github.com/sirupsen/logrus"
@@ -70,3 +71,13 @@ func findRemovedRoutes(newRoutes, oldRoutes []Route) []Route {
return removed
}
func prefixToMask(prefix netip.Prefix) netip.Addr {
pLen := 128
if prefix.Addr().Is4() {
pLen = 32
}
addr, _ := netip.AddrFromSlice(net.CIDRMask(prefix.Bits(), pLen))
return addr
}