mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-29 10:09:08 +01:00
1de3bb5420
Add netstack support for the agent to run it without privileges. - use interface for tun device - use common IPC for userspace WireGuard integration - move udpmux creation and sharedsock to tun layer
27 lines
490 B
Go
27 lines
490 B
Go
//go:build !windows
|
|
|
|
package iface
|
|
|
|
import (
|
|
"net"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
"golang.zx2c4.com/wireguard/ipc"
|
|
)
|
|
|
|
func openUAPI(deviceName string) (net.Listener, error) {
|
|
uapiSock, err := ipc.UAPIOpen(deviceName)
|
|
if err != nil {
|
|
log.Errorf("failed to open uapi socket: %v", err)
|
|
return nil, err
|
|
}
|
|
|
|
listener, err := ipc.UAPIListen(deviceName, uapiSock)
|
|
if err != nil {
|
|
log.Errorf("failed to listen on uapi socket: %v", err)
|
|
return nil, err
|
|
}
|
|
|
|
return listener, nil
|
|
}
|