Skip to content

Commit

Permalink
Add support for setting IPv6 address on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtom5152 committed Apr 1, 2024
1 parent 5a94b57 commit 228ee7c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/vpn/interface_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ func prepareInterface(c *Config) error {

// Add the address to the interface. This is not directly possible with the `net` package,
// so we use the `ifconfig` command.
cmd = exec.Command("ifconfig", iface.Name, "inet", ip.String(), ip.String())
if ip.To4() == nil {
// IPV6
cmd = exec.Command("ifconfig", iface.Name, "inet6", ip.String())
} else {
// IPv4
cmd = exec.Command("ifconfig", iface.Name, "inet", ip.String(), ip.String())
}
err = cmd.Run()
if err != nil {
return err
Expand Down

0 comments on commit 228ee7c

Please sign in to comment.