Split create Interface based on OS

This commit is contained in:
mlsmaycon
2021-06-06 15:48:57 +02:00
parent 59360519d6
commit 6e4c232ff2
3 changed files with 24 additions and 3 deletions

View File

@ -4,9 +4,15 @@ 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)