5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-26 13:01:39 +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" "strings"
"unsafe" "unsafe"
"github.com/yggdrasil-network/yggdrasil-go/src/defaults"
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
wgtun "golang.zx2c4.com/wireguard/tun" wgtun "golang.zx2c4.com/wireguard/tun"
@ -19,6 +20,9 @@ import (
// Configures the TUN adapter with the correct IPv6 address and MTU. // Configures the TUN adapter with the correct IPv6 address and MTU.
func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error { func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error {
if ifname == "auto" {
ifname = defaults.GetDefaults().IfName
}
var err error var err error
err = doAsSystem(func() { err = doAsSystem(func() {
iface, err := wgtun.CreateTUN(ifname, mtu) iface, err := wgtun.CreateTUN(ifname, mtu)