fixing client issues for uspace, fwmark, vpn

This commit is contained in:
afeiszli
2021-11-29 04:34:11 -05:00
parent 07b2055abf
commit 801919ab0d
14 changed files with 122 additions and 41 deletions

View File

@@ -6,9 +6,7 @@ import (
"errors"
"fmt"
"log"
"math/rand"
"os/exec"
"time"
nodepb "github.com/gravitl/netmaker/grpc"
"github.com/gravitl/netmaker/models"
@@ -35,12 +33,6 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string) error {
err := errors.New("ALREADY_INSTALLED. Netclient appears to already be installed for " + cfg.Network + ". To re-install, please remove by executing 'sudo netclient leave -n " + cfg.Network + "'. Then re-run the install command.")
return err
}
if cfg.FWMark == 0 {
rand.Seed(time.Now().UnixNano())
var min int32 = 1000
var max int32 = 9999
cfg.FWMark = rand.Int31n(max-min) + min
}
err = config.Write(&cfg, cfg.Network)
if err != nil {
@@ -111,6 +103,7 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string) error {
MacAddress: cfg.Node.MacAddress,
AccessKey: cfg.Server.AccessKey,
IsStatic: cfg.Node.IsStatic,
Roaming: cfg.Node.Roaming,
Network: cfg.Network,
ListenPort: cfg.Node.ListenPort,
PostUp: cfg.Node.PostUp,