Get default route and local subnet only at start
This commit is contained in:
@@ -26,13 +26,8 @@ func (c *configurator) SetVPNConnections(ctx context.Context, connections []mode
|
||||
return nil
|
||||
}
|
||||
|
||||
defaultInterface, _, err := c.routing.DefaultRoute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot set VPN connections through firewall: %w", err)
|
||||
}
|
||||
|
||||
c.removeConnections(ctx, connectionsToRemove, defaultInterface)
|
||||
if err := c.addConnections(ctx, connectionsToAdd, defaultInterface); err != nil {
|
||||
c.removeConnections(ctx, connectionsToRemove, c.defaultInterface)
|
||||
if err := c.addConnections(ctx, connectionsToAdd, c.defaultInterface); err != nil {
|
||||
return fmt.Errorf("cannot set VPN connections through firewall: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user