Replaces powershell with the route command and cache route lookups on windows (#1880)

This commit is contained in:
Viktor Liu
2024-04-26 16:37:27 +02:00
committed by GitHub
parent 71c6437bab
commit 54b045d9ca
11 changed files with 161 additions and 135 deletions

View File

@@ -5,6 +5,7 @@ package routemanager
import (
"errors"
"fmt"
"net"
"net/netip"
"sync"
@@ -17,7 +18,7 @@ import (
type ref struct {
count int
nexthop netip.Addr
intf string
intf *net.Interface
}
type RouteManager struct {
@@ -30,8 +31,8 @@ type RouteManager struct {
mutex sync.Mutex
}
type AddRouteFunc func(prefix netip.Prefix) (nexthop netip.Addr, intf string, err error)
type RemoveRouteFunc func(prefix netip.Prefix, nexthop netip.Addr, intf string) error
type AddRouteFunc func(prefix netip.Prefix) (nexthop netip.Addr, intf *net.Interface, err error)
type RemoveRouteFunc func(prefix netip.Prefix, nexthop netip.Addr, intf *net.Interface) error
func NewRouteManager(addRoute AddRouteFunc, removeRoute RemoveRouteFunc) *RouteManager {
// TODO: read initial routing table into refCountMap