Skip to content

Commit

Permalink
Removed elevate for now
Browse files Browse the repository at this point in the history
  • Loading branch information
mlsmaycon committed Jun 6, 2021
1 parent 54235f0 commit 698ebe2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 24 deletions.
2 changes: 1 addition & 1 deletion iface/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var tunIface tun.Device
// Will reuse an existing one.
func Create(iface string, address string) error {
var err error
tunIface, err = createIface(iface, defaultMTU)
tunIface, err = tun.CreateTUN(iface, defaultMTU)
if err != nil {
return err
}
Expand Down
6 changes: 0 additions & 6 deletions iface/iface_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@ package iface

import (
"golang.zx2c4.com/wireguard/ipc"
"golang.zx2c4.com/wireguard/tun"
"net"
)

// createIface creates a tun device
func createIface(iface string, defaultMTU int) (tun.Device, error) {
return tun.CreateTUN(iface, defaultMTU)
}

// getUAPI returns a Listener
func getUAPI(iface string) (net.Listener, error) {
tunSock, err := ipc.UAPIOpen(iface)
Expand Down
17 changes: 0 additions & 17 deletions iface/iface_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
log "github.com/sirupsen/logrus"
"golang.zx2c4.com/wireguard/ipc"
"golang.zx2c4.com/wireguard/tun"
"golang.zx2c4.com/wireguard/windows/elevate"
"golang.zx2c4.com/wireguard/windows/tunnel/winipcfg"
"net"
)
Expand All @@ -31,22 +30,6 @@ func assignAddr(address string, tunDevice tun.Device) error {
return nil
}

// createIface creates a tun device
func createIface(iface string, defaultMTU int) (tun.Device, error) {

var tunDevice tun.Device
err := elevate.DoAsSystem(func() error {
var err error
tunDevice, err = tun.CreateTUN(iface, defaultMTU)
return err
})
if err != nil {
log.Errorln("Failed to create the tunnel device: ", err)
return nil, err
}
return tunDevice, err
}

// getUAPI returns a Listener
func getUAPI(iface string) (net.Listener, error) {
return ipc.UAPIListen(iface)
Expand Down

0 comments on commit 698ebe2

Please sign in to comment.