Skip to content

Commit

Permalink
Split create Interface based on OS with elevate
Browse files Browse the repository at this point in the history
  • Loading branch information
mlsmaycon committed Jun 6, 2021
1 parent 6e4c232 commit 255ad7f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions iface/iface_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package iface

import (
log "github.com/sirupsen/logrus"
"net"

"golang.zx2c4.com/wireguard/ipc"
"golang.zx2c4.com/wireguard/tun"
"golang.zx2c4.com/wireguard/windows/elevate"
"golang.zx2c4.com/wireguard/windows/tunnel/winipcfg"
"net"
)

// assignAddr Adds IP address to the tunnel interface and network route based on the range provided
Expand Down Expand Up @@ -38,7 +37,7 @@ func createIface(iface string, defaultMTU int) (tun.Device, error) {
var tunDevice tun.Device
err := elevate.DoAsSystem(func() error {
var err error
tunDevice, err = tun.CreateTUNWithRequestedGUID(iface, &windows.GUID{12, 12, 12, [8]byte{12, 12, 12, 12, 12, 12, 12, 12}}, defaultMTU)
tunDevice, err = tun.CreateTUN(iface, defaultMTU)
return err
})
if err != nil {
Expand Down

0 comments on commit 255ad7f

Please sign in to comment.