5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-23 04:05:39 +00:00

Reuse GUID so Windows no longer keeps creating new networks each time Yggdrasil starts

This commit is contained in:
Neil Alexander 2019-11-23 13:34:27 +00:00
parent baebaabc43
commit 0529910b01
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -24,8 +24,13 @@ func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error {
ifname = defaults.GetDefaults().DefaultIfName
}
var err error
var iface wgtun.Device
err = doAsSystem(func() {
iface, err := wgtun.CreateTUN(ifname, mtu)
if guid, gerr := windows.GUIDFromString("{8f59971a-7872-4aa6-b2eb-061fc4e9d0a7}"); gerr == nil {
iface, err = wgtun.CreateTUNWithRequestedGUID(ifname, &guid, mtu)
} else {
panic(gerr)
}
if err != nil {
panic(err)
}