Closed BirkhoffLee closed 6 years ago
The issue is that I only developed this for Linux to suite my needs. It seems the API for water
is slightly different on darwin
. This block of code currently makes a lot of assumptions about Linux:
conf := water.Config{DeviceType: water.TUN}
conf.Name = t.tunDev
iface, err := water.New(conf)
if err != nil {
t.log.Fatalf("error creating tun device: %v", err)
}
defer iface.Close()
if err := exec.Command("/sbin/ip", "link", "set", "dev", t.tunDev, "mtu", "1300").Run(); err != nil {
t.log.Fatalf("ip link error: %v", err)
}
if err := exec.Command("/sbin/ip", "addr", "add", t.tunAddr+"/24", "dev", t.tunDev).Run(); err != nil {
t.log.Fatalf("ip addr error: %v", err)
}
if err := exec.Command("/sbin/ip", "link", "set", "dev", t.tunDev, "up").Run(); err != nil {
t.log.Fatalf("ip link error: %v", err)
}
You're welcome to make a pull request to switch all that over to darwin
specific functionality.
For example, the ip
command doesn't exist on darwin
.