Peer management login (#83)

* feature: replace RegisterPeer with Login method that does both - registration and login

* test: add management login test

* feature: add WiretrusteeConfig to the Login response to configure peer global config

* feature: add client peer login support

* fix: missing parts

* chore: update go deps

* feature: support Management Service gRPC endpoints [CLIENT]

* feature: finalize client sync with management

* fix: management store peer key lower case restore

* fix: management returns peer ip without a mask

* refactor: remove cmd pkg

* fix: invalid tun interface name on mac

* fix: timeout when calling management client

* fix: tests and lint errors

* fix: golang-test workflow

* fix: client service tests

* fix: iface build

* feature: detect management scheme on startup

* chore: better logs for management

* fix: goreleaser

* fix: lint errors

* fix: signal TLS

* fix: direct Wireguard connection

* chore: verbose logging on direct connection
This commit is contained in:
Mikhail Bragin
2021-08-15 16:56:26 +02:00
committed by GitHub
parent 80de6a75d5
commit 877ad97a96
34 changed files with 1139 additions and 783 deletions
+24
View File
@@ -74,6 +74,30 @@ func configureDevice(iface string, config wgtypes.Config) error {
return wg.ConfigureDevice(iface, config)
}
// Exists checks whether specified Wireguard device exists or not
func Exists(iface string) (*bool, error) {
wg, err := wgctrl.New()
if err != nil {
return nil, err
}
defer wg.Close()
devices, err := wg.Devices()
if err != nil {
return nil, err
}
var exists bool
for _, d := range devices {
if d.Name == iface {
exists = true
return &exists, nil
}
}
exists = false
return &exists, nil
}
// Configure configures a Wireguard interface
// The interface must exist before calling this method (e.g. call interface.Create() before)
func Configure(iface string, privateKey string) error {
+1 -1
View File
@@ -44,7 +44,7 @@ func CreateWithKernel(iface string, address string) error {
}
// todo do a discovery
log.Debugf("setting MTU: %s", iface)
log.Debugf("setting MTU: %d interface: %s", defaultMTU, iface)
err = netlink.LinkSetMTU(&link, defaultMTU)
if err != nil {
log.Errorf("error setting MTU on interface: %s", iface)
+6
View File
@@ -0,0 +1,6 @@
// +build linux windows
package iface
// WgInterfaceDefault is a default interface name of Wiretrustee
const WgInterfaceDefault = "wt0"
+6
View File
@@ -0,0 +1,6 @@
// +build darwin
package iface
// WgInterfaceDefault is a default interface name of Wiretrustee
const WgInterfaceDefault = "utun100"