chore: move conf package

This commit is contained in:
Noah Hsu
2022-06-25 20:38:02 +08:00
parent 7dadab95b2
commit 306b90399c
18 changed files with 91 additions and 33 deletions

View File

@ -1,12 +1,12 @@
package utils
import (
"github.com/alist-org/alist/v3/internal/conf"
"io"
"io/ioutil"
"os"
"path/filepath"
"github.com/alist-org/alist/v3/conf"
log "github.com/sirupsen/logrus"
)

23
pkg/utils/random.go Normal file
View File

@ -0,0 +1,23 @@
package utils
import (
"math/rand"
"time"
)
var Rand *rand.Rand
const letterBytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
func RandomStr(n int) string {
b := make([]byte, n)
for i := range b {
b[i] = letterBytes[Rand.Intn(len(letterBytes))]
}
return string(b)
}
func init() {
s := rand.NewSource(time.Now().UnixNano())
Rand = rand.New(s)
}