mirror of
https://github.com/fosrl/newt.git
synced 2026-02-07 21:46:39 +00:00
Fix incrementor not updating; restrict routes to darwin
This commit is contained in:
@@ -126,13 +126,14 @@ func LinuxRemoveRoute(destination string) error {
|
|||||||
|
|
||||||
// addRouteForServerIP adds an OS-specific route for the server IP
|
// addRouteForServerIP adds an OS-specific route for the server IP
|
||||||
func AddRouteForServerIP(serverIP, interfaceName string) error {
|
func AddRouteForServerIP(serverIP, interfaceName string) error {
|
||||||
if err := AddRouteForNetworkConfig(serverIP); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if interfaceName == "" {
|
if interfaceName == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if runtime.GOOS == "darwin" {
|
// TODO: does this also need to be ios?
|
||||||
|
if runtime.GOOS == "darwin" { // macos requires routes for each peer to be added but this messes with other platforms
|
||||||
|
if err := AddRouteForNetworkConfig(serverIP); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return DarwinAddRoute(serverIP, "", interfaceName)
|
return DarwinAddRoute(serverIP, "", interfaceName)
|
||||||
}
|
}
|
||||||
// else if runtime.GOOS == "windows" {
|
// else if runtime.GOOS == "windows" {
|
||||||
@@ -145,13 +146,14 @@ func AddRouteForServerIP(serverIP, interfaceName string) error {
|
|||||||
|
|
||||||
// removeRouteForServerIP removes an OS-specific route for the server IP
|
// removeRouteForServerIP removes an OS-specific route for the server IP
|
||||||
func RemoveRouteForServerIP(serverIP string, interfaceName string) error {
|
func RemoveRouteForServerIP(serverIP string, interfaceName string) error {
|
||||||
if err := RemoveRouteForNetworkConfig(serverIP); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if interfaceName == "" {
|
if interfaceName == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if runtime.GOOS == "darwin" {
|
// TODO: does this also need to be ios?
|
||||||
|
if runtime.GOOS == "darwin" { // macos requires routes for each peer to be added but this messes with other platforms
|
||||||
|
if err := RemoveRouteForNetworkConfig(serverIP); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return DarwinRemoveRoute(serverIP)
|
return DarwinRemoveRoute(serverIP)
|
||||||
}
|
}
|
||||||
// else if runtime.GOOS == "windows" {
|
// else if runtime.GOOS == "windows" {
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ func RemoveIPv4IncludedRoute(route IPv4Route) {
|
|||||||
if r == route {
|
if r == route {
|
||||||
networkSettings.IPv4IncludedRoutes = append(routes[:i], routes[i+1:]...)
|
networkSettings.IPv4IncludedRoutes = append(routes[:i], routes[i+1:]...)
|
||||||
logger.Info("Removed IPv4 included route: %+v", route)
|
logger.Info("Removed IPv4 included route: %+v", route)
|
||||||
return
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
incrementor++
|
incrementor++
|
||||||
|
|||||||
Reference in New Issue
Block a user