Browse Source

PR comments resolved

Abhishek Kondur 2 years ago
parent
commit
acd7a70b77
4 changed files with 8 additions and 10 deletions
  1. 2 0
      logic/accesskeys.go
  2. 0 1
      logic/metrics.go
  3. 1 1
      logic/util.go
  4. 5 8
      mq/dynsec.go

+ 2 - 0
logic/accesskeys.go

@@ -221,11 +221,13 @@ func genKeyName() string {
 	return strings.Join([]string{"key", entropy.Text(16)[:16]}, "-")
 }
 
+// GenKey - generates random key of length 16
 func GenKey() string {
 	entropy, _ := rand.Int(rand.Reader, maxentropy)
 	return entropy.Text(16)[:16]
 }
 
+// GenPassWord - generates random password of length 64
 func GenPassWord() string {
 	entropy, _ := rand.Int(rand.Reader, maxentropy)
 	return entropy.Text(62)[:64]

+ 0 - 1
logic/metrics.go

@@ -58,7 +58,6 @@ func CollectServerMetrics(serverID string, networkNodes []models.Node) *models.M
 			newServerMetrics.Connectivity[currNodeID] = models.Metric{
 				Connected: false,
 				Latency:   999,
-				PercentUp: 0,
 			}
 		}
 	}

+ 1 - 1
logic/util.go

@@ -219,7 +219,7 @@ func StringDifference(a, b []string) []string {
 	return diff
 }
 
-// CheckIfFileExists - checks if file exists or no in the given path
+// CheckIfFileExists - checks if file exists or not in the given path
 func CheckIfFileExists(filePath string) bool {
 	if _, err := os.Stat(filePath); os.IsNotExist(err) {
 		return false

+ 5 - 8
mq/dynsec.go

@@ -18,12 +18,6 @@ import (
 	"golang.org/x/crypto/pbkdf2"
 )
 
-// DynamicSecSubTopic - constant for dynamic security subscription topic
-const dynamicSecSubTopic = "$CONTROL/dynamic-security/#"
-
-// DynamicSecPubTopic - constant for dynamic security subscription topic
-const dynamicSecPubTopic = "$CONTROL/dynamic-security/v1"
-
 // mq client for admin
 var mqAdminClient mqtt.Client
 
@@ -41,15 +35,18 @@ const (
 	CreateRoleCmd = "createRole"
 	// constant for delete role command
 	DeleteRoleCmd = "deleteRole"
-)
 
-const (
 	// constant for admin user name
 	mqAdminUserName = "Netmaker-Admin"
 	// constant for server user name
 	mqNetmakerServerUserName = "Netmaker-Server"
 	// constant for exporter user name
 	mqExporterUserName = "Netmaker-Exporter"
+
+	// DynamicSecSubTopic - constant for dynamic security subscription topic
+	dynamicSecSubTopic = "$CONTROL/dynamic-security/#"
+	// DynamicSecPubTopic - constant for dynamic security subscription topic
+	dynamicSecPubTopic = "$CONTROL/dynamic-security/v1"
 )
 
 // struct for dynamic security file