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:
Maycon Santos
2021-08-29 17:48:31 +02:00
committed by GitHub
parent 4f4edf8442
commit a31cbb1f5b
12 changed files with 329 additions and 97 deletions

View File

@@ -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
}