5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 13:00:47 +00:00

Fix IfName 'auto' behaviour on Windows

This commit is contained in:
Neil Alexander 2019-11-22 20:11:39 +00:00
parent f95ebeb821
commit 3a0870a448
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -9,6 +9,7 @@ import (
"strings"
"unsafe"
"github.com/yggdrasil-network/yggdrasil-go/src/defaults"
"golang.org/x/sys/windows"
wgtun "golang.zx2c4.com/wireguard/tun"
@ -19,6 +20,9 @@ import (
// Configures the TUN adapter with the correct IPv6 address and MTU.
func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error {
if ifname == "auto" {
ifname = defaults.GetDefaults().IfName
}
var err error
err = doAsSystem(func() {
iface, err := wgtun.CreateTUN(ifname, mtu)