diff --git a/logic/accesskeys.go b/logic/accesskeys.go index 337693f9..b3f9ebc0 100644 --- a/logic/accesskeys.go +++ b/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] diff --git a/logic/metrics.go b/logic/metrics.go index f7fd44f5..f60bcd76 100644 --- a/logic/metrics.go +++ b/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, } } } diff --git a/logic/util.go b/logic/util.go index a87faca9..451c07c0 100644 --- a/logic/util.go +++ b/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 diff --git a/mq/dynsec.go b/mq/dynsec.go index e19eb0fe..211d2a84 100644 --- a/mq/dynsec.go +++ b/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