routes for different OSs should be handled, cleaned up apply conf

This commit is contained in:
0xdcarns
2022-02-05 14:20:50 -05:00
parent ac5eea4e3d
commit a0ae603a42
8 changed files with 70 additions and 52 deletions

View File

@@ -7,6 +7,8 @@ import (
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)
// TODO handle ipv6 in future
// SetPeerRoutes - sets/removes ip routes for each peer on a network
func SetPeerRoutes(iface, currentNodeAddr string, oldPeers map[string][]net.IPNet, newPeers []wgtypes.PeerConfig) {
// traverse through all recieved peers
@@ -55,3 +57,8 @@ func SetCurrentPeerRoutes(iface, currentAddr string, peers []wgtypes.Peer) {
}
}
}
// SetCIDRRoute - sets the CIDR route, used on join and restarts
func SetCIDRRoute(iface, currentAddr string, cidr *net.IPNet) {
setCidr(iface, currentAddr, cidr)
}