mirror of
https://github.com/netbirdio/netbird.git
synced 2025-01-27 00:09:34 +01:00
45a6263adc
Add new feature to notify the user when new client route has arrived. Refactor the initial route handling. I move every route logic into the route manager package. * Add notification management for client rules * Export the route notification for Android * Compare the notification based on network range instead of id.
33 lines
711 B
Go
33 lines
711 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, 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
|
|
}
|
|
|
|
// SetInitialRoutes unused function on non Android
|
|
func (w *WGIface) SetInitialRoutes(routes []string) {
|
|
|
|
}
|