diff --git a/misc/tests/tunbench-client.go b/misc/tests/tunbench-client.go index ac38b502..9e606799 100644 --- a/misc/tests/tunbench-client.go +++ b/misc/tests/tunbench-client.go @@ -7,7 +7,7 @@ import ( "os/exec" "time" - "github.com/songgao/water" + "github.com/neilalexander/water" ) const mtu = 65535 diff --git a/misc/tests/tunbench-server.go b/misc/tests/tunbench-server.go index 12c114fe..288cea25 100644 --- a/misc/tests/tunbench-server.go +++ b/misc/tests/tunbench-server.go @@ -6,7 +6,7 @@ import ( "net" "os/exec" - "github.com/songgao/water" + "github.com/neilalexander/water" ) const mtu = 65535 diff --git a/misc/tests/tunbench.go b/misc/tests/tunbench.go index 02b75e72..ac9205e2 100644 --- a/misc/tests/tunbench.go +++ b/misc/tests/tunbench.go @@ -6,7 +6,7 @@ import ( "net" "os/exec" - "github.com/songgao/water" + "github.com/neilalexander/water" ) const mtu = 65535 diff --git a/src/yggdrasil/tun_bsd.go b/src/yggdrasil/tun_bsd.go new file mode 100644 index 00000000..4e3fa0c1 --- /dev/null +++ b/src/yggdrasil/tun_bsd.go @@ -0,0 +1,29 @@ +// +build openbsd freebsd solaris + +package yggdrasil + +import water "github.com/neilalexander/water" + +// This is to catch BSD platforms + +func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int) error { + var config water.Config + if iftapmode { + config = water.Config{DeviceType: water.TAP} + } else { + config = water.Config{DeviceType: water.TUN} + } + config.Name = ifname + iface, err := water.New(config) + if err != nil { + panic(err) + } + tun.iface = iface + tun.mtu = mtu //1280 // Lets default to the smallest thing allowed for now + return tun.setupAddress(addr) +} + +func (tun *tunDevice) setupAddress(addr string) error { + tun.core.log.Println("Platform not supported, you must set the address of", tun.iface.Name(), "to", addr) + return nil +} diff --git a/src/yggdrasil/tun_darwin.go b/src/yggdrasil/tun_darwin.go index 0e2fa245..eb1489f3 100644 --- a/src/yggdrasil/tun_darwin.go +++ b/src/yggdrasil/tun_darwin.go @@ -8,7 +8,7 @@ import "strconv" import "encoding/binary" import "golang.org/x/sys/unix" -import water "github.com/songgao/water" +import water "github.com/neilalexander/water" func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int) error { if iftapmode { diff --git a/src/yggdrasil/tun_linux.go b/src/yggdrasil/tun_linux.go index 8748aa92..5fdf6409 100644 --- a/src/yggdrasil/tun_linux.go +++ b/src/yggdrasil/tun_linux.go @@ -7,7 +7,7 @@ import "fmt" import "os/exec" import "strings" -import water "github.com/songgao/water" +import water "github.com/neilalexander/water" func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int) error { var config water.Config diff --git a/src/yggdrasil/tun_other.go b/src/yggdrasil/tun_other.go index 388260cd..147e55ad 100644 --- a/src/yggdrasil/tun_other.go +++ b/src/yggdrasil/tun_other.go @@ -1,10 +1,13 @@ // +build !linux // +build !darwin // +build !windows +// +build !openbsd +// +build !freebsd +// +build !solaris package yggdrasil -import water "github.com/songgao/water" +import water "github.com/neilalexander/water" // This is to catch unsupported platforms // If your platform supports tun devices, you could try configuring it manually diff --git a/src/yggdrasil/tun_windows.go b/src/yggdrasil/tun_windows.go index acaf20fc..a2108fe9 100644 --- a/src/yggdrasil/tun_windows.go +++ b/src/yggdrasil/tun_windows.go @@ -1,6 +1,6 @@ package yggdrasil -import water "github.com/songgao/water" +import water "github.com/neilalexander/water" import "os/exec" import "strings" import "fmt"