diff --git a/tun/tun.go b/tun/tun.go index d87b4f4..3524986 100644 --- a/tun/tun.go +++ b/tun/tun.go @@ -1,5 +1,5 @@ -//go:build !windows -// +build !windows +//go:build !windows && !linux +// +build !windows,!linux package tun @@ -11,7 +11,7 @@ import ( ) // New creates and returns a new TUN interface for the application. -func New(name string, address string) (result *water.Interface, err error) { +func New(name, address string) (result *water.Interface, err error) { // Setup TUN Config cfg := water.Config{ DeviceType: water.TUN, diff --git a/tun/tun_linux.go b/tun/tun_linux.go index 160e1af..b2d1b02 100644 --- a/tun/tun_linux.go +++ b/tun/tun_linux.go @@ -9,7 +9,7 @@ import ( ) // New creates and returns a new TUN interface for the application. -func New(name string) (result *water.Interface, err error) { +func New(name, address string) (result *water.Interface, err error) { // Setup TUN Config cfg := water.Config{ DeviceType: water.TUN, diff --git a/tun/tun_windows.go b/tun/tun_windows.go index 99cc55a..3d1c78a 100644 --- a/tun/tun_windows.go +++ b/tun/tun_windows.go @@ -4,15 +4,15 @@ package tun import ( - "os/exec" - "net" "fmt" + "net" + "os/exec" "github.com/songgao/water" ) // New creates and returns a new TUN interface for the application. -func New(name string, address string) (result *water.Interface, err error) { +func New(name, address string) (result *water.Interface, err error) { // TUN on Windows requires address and network to be set on device creation stage // We also set network to 0.0.0.0/0 so we able to reach networks behind the node // https://github.com/songgao/water/blob/master/params_windows.go @@ -23,7 +23,7 @@ func New(name string, address string) (result *water.Interface, err error) { } network := net.IPNet{ IP: ip, - Mask: net.IPv4Mask(0,0,0,0), + Mask: net.IPv4Mask(0, 0, 0, 0), } // Setup TUN Config cfg := water.Config{