Browse Source

adding necessary changes for client and server key to work

afeiszli 4 years ago
parent
commit
587442dfe3
3 changed files with 9 additions and 5 deletions
  1. 1 1
      controllers/networkHttpController.go
  2. 7 3
      netclient/functions/common.go
  3. 1 1
      serverctl/serverctl.go

+ 1 - 1
controllers/networkHttpController.go

@@ -526,7 +526,7 @@ func createAccessKey(w http.ResponseWriter, r *http.Request) {
 	netID := params["networkname"]
 	address := gconf.ServerGRPC + gconf.PortGRPC
 
-	accessstringdec := address + "." + netID + "." + accesskey.Value + "." + privAddr
+	accessstringdec := address + "|" + netID + "|" + accesskey.Value + "|" + privAddr
 	accesskey.AccessString = base64.StdEncoding.EncodeToString([]byte(accessstringdec))
 
 	network.AccessKeys = append(network.AccessKeys, accesskey)

+ 7 - 3
netclient/functions/common.go

@@ -93,7 +93,7 @@ func Install(accesskey string, password string, server string, network string, n
 			log.Fatalf("Something went wrong decoding your token: %v", err)
 		}
 		token := string(btoken)
-		tokenvals := strings.Split(token, ".")
+		tokenvals := strings.Split(token, "|")
 		tserver = tokenvals[0]
 		tnetwork = tokenvals[1]
 		tkey = tokenvals[2]
@@ -108,11 +108,15 @@ func Install(accesskey string, password string, server string, network string, n
 		if accesskey == "badkey" {
 			accesskey = tkey
 		}
+		fmt.Println(trange)
 		if trange != "" {
 			islocal = true
 			_, localrange, err = net.ParseCIDR(trange)
-			printrange = localrange.String()
-
+			if err == nil {
+				printrange = localrange.String()
+			} else {
+				//localrange = ""
+			}
 		} else {
 			printrange = "Not a local network. Will use public address for endpoint."
 		}

+ 1 - 1
serverctl/serverctl.go

@@ -13,7 +13,7 @@ import (
 func DownloadNetclient() error {
 
 	// Get the data
-	resp, err := http.Get("https://github.com/gravitl/netmaker/releases/download/develop/netclient")
+	resp, err := http.Get("https://github.com/gravitl/netmaker/releases/download/latest/netclient")
 	if err != nil {
 		return err
 	}