Initial logic to support logging activity on Wings to send back to the panel

This commit is contained in:
DaneEveritt
2022-07-04 17:36:03 -04:00
parent 214baf83fb
commit 9eab08b92f
10 changed files with 256 additions and 8 deletions

20
system/strings.go Normal file
View File

@@ -0,0 +1,20 @@
package system
import (
"math/rand"
"strings"
)
const characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
// RandomString generates a random string of alpha-numeric characters using a
// pseudo-random number generator. The output of this function IS NOT cryptographically
// secure, it is used solely for generating random strings outside a security context.
func RandomString(n int) string {
var b strings.Builder
b.Grow(n)
for i := 0; i < n; i++ {
b.WriteByte(characters[rand.Intn(len(characters))])
}
return b.String()
}