Prototype of DirStore and some routes for working with buckets

This commit is contained in:
2022-06-30 04:26:33 +02:00
parent 8d16099c10
commit 915bd5ee65
10 changed files with 393 additions and 35 deletions
+23
View File
@@ -0,0 +1,23 @@
package utils
import (
"encoding/hex"
"math/rand"
"time"
)
const alphabet = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
func init() {
rand.Seed(time.Now().UnixNano())
}
func GenerateRandomString(n int) string {
b := make([]byte, n/2)
if _, err := rand.Read(b); err != nil {
panic(err)
}
return hex.EncodeToString(b)
}