mirror of
https://github.com/netbirdio/netbird.git
synced 2025-08-18 19:09:09 +02:00
abstract peer channel (#101)
* abstract peer channel * remove wip code * refactor NewServer with Peer updates channel * add PeersUpdateManager tests * adding documentation * using older version of linter * verbose lint * skip cache * setup go version * extra output * configure fetch-depth * exit 0 * skip-build-cache: true * disabling failure for lint for now * fix: darwin issue * enable lint failure * remove sock file for macOS * refactor: remove tests interdependence * fixed linux native iface Co-authored-by: braginini <bangvalo@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package iface
|
||||
import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
@@ -40,5 +41,23 @@ func addRoute(iface string, ipNet *net.IPNet) error {
|
||||
|
||||
// Closes the tunnel interface
|
||||
func Close() error {
|
||||
return CloseWithUserspace()
|
||||
name, err := tunIface.Name()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sockPath := "/var/run/wireguard/" + name + ".sock"
|
||||
|
||||
err = CloseWithUserspace()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := os.Stat(sockPath); err == nil {
|
||||
err = os.Remove(sockPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user