diff options
Diffstat (limited to 'tun_darwin.go')
-rw-r--r-- | tun_darwin.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tun_darwin.go b/tun_darwin.go index 8f9a5d5..ed055b2 100644 --- a/tun_darwin.go +++ b/tun_darwin.go @@ -12,6 +12,7 @@ import ( "fmt" "golang.org/x/net/ipv6" "golang.org/x/sys/unix" + "io/ioutil" "net" "os" "time" @@ -104,7 +105,10 @@ func CreateTUN(name string) (TUNDevice, error) { tun, err := CreateTUNFromFile(os.NewFile(uintptr(fd), "")) if err == nil && name == "utun" { - fmt.Printf("OS assigned interface: %s\n", tun.(*NativeTun).name) + fname := os.Getenv("WG_DARWIN_UTUN_NAME_FILE") + if fname != "" { + ioutil.WriteFile(fname, []byte(tun.(*NativeTun).name+"\n"), 0400) + } } return tun, err |