Skip to content

Commit

Permalink
Merge pull request #167 from mauromorales/master
Browse files Browse the repository at this point in the history
Add route on macOS
  • Loading branch information
mudler committed Apr 11, 2024
2 parents 8bc37cc + 7a9abb2 commit 1ae9a98
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/vpn/interface_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func prepareInterface(c *Config) error {
return err
}

ip, _, err := net.ParseCIDR(c.InterfaceAddress)
ip, ipNet, err := net.ParseCIDR(c.InterfaceAddress)
if err != nil {
return err
}
Expand Down Expand Up @@ -68,5 +68,12 @@ func prepareInterface(c *Config) error {
return err
}

// Add route
cmd = exec.Command("route", "-n", "add", "-net", ipNet.String(), ip.String())
err = cmd.Run()
if err != nil {
return err
}

return nil
}

0 comments on commit 1ae9a98

Please sign in to comment.