mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-29 03:23:56 +01:00
4616bc5258
Support client route management feature on Android
28 lines
619 B
Go
28 lines
619 B
Go
//go:build !android
|
|
|
|
package iface
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/pion/transport/v2"
|
|
)
|
|
|
|
// NewWGIFace Creates a new WireGuard interface instance
|
|
func NewWGIFace(iFaceName string, address string, mtu int, routes []string, tunAdapter TunAdapter, transportNet transport.Net) (*WGIface, error) {
|
|
wgIFace := &WGIface{
|
|
mu: sync.Mutex{},
|
|
}
|
|
|
|
wgAddress, err := parseWGAddress(address)
|
|
if err != nil {
|
|
return wgIFace, err
|
|
}
|
|
|
|
wgIFace.tun = newTunDevice(iFaceName, wgAddress, mtu, transportNet)
|
|
|
|
wgIFace.configurer = newWGConfigurer(iFaceName)
|
|
wgIFace.userspaceBind = !WireGuardModuleIsLoaded()
|
|
return wgIFace, nil
|
|
}
|