feature: add feature to determine when to run wireguard userspace implementation or native one (linux)

This commit is contained in:
braginini
2021-06-23 16:11:54 +02:00
parent dd72a01ecf
commit 4216cd2986
5 changed files with 97 additions and 91 deletions

View File

@@ -2,7 +2,6 @@ package iface
import (
log "github.com/sirupsen/logrus"
"golang.zx2c4.com/wireguard/tun"
"net"
"os/exec"
"strings"
@@ -13,8 +12,7 @@ import (
//)
// assignAddr Adds IP address to the tunnel interface and network route based on the range provided
func assignAddr(address string, tunDevice tun.Device) error {
ifaceName, err := tunDevice.Name()
func assignAddr(address string, ifaceName string) error {
ip := strings.Split(address, "/")
cmd := exec.Command("ifconfig", ifaceName, "inet", address, ip[0])
if out, err := cmd.CombinedOutput(); err != nil {