mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-29 11:33:48 +01:00
23 lines
470 B
Go
23 lines
470 B
Go
|
//go:build !android
|
||
|
|
||
|
package iface
|
||
|
|
||
|
import "sync"
|
||
|
|
||
|
// NewWGIFace Creates a new Wireguard interface instance
|
||
|
func NewWGIFace(ifaceName string, address string, mtu int, tunAdapter TunAdapter) (*WGIface, error) {
|
||
|
wgIface := &WGIface{
|
||
|
mu: sync.Mutex{},
|
||
|
}
|
||
|
|
||
|
wgAddress, err := parseWGAddress(address)
|
||
|
if err != nil {
|
||
|
return wgIface, err
|
||
|
}
|
||
|
|
||
|
wgIface.tun = newTunDevice(ifaceName, wgAddress, mtu)
|
||
|
|
||
|
wgIface.configurer = newWGConfigurer(ifaceName)
|
||
|
return wgIface, nil
|
||
|
}
|