mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-07 16:54:16 +01:00
Split create Interface based on OS with elevate
This commit is contained in:
parent
6e4c232ff2
commit
255ad7faa9
@ -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
|
||||
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user