mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-12-02 01:53:16 +00:00
add oauth loginlog & fix bugs
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/md5"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
"runtime/debug"
|
||||
)
|
||||
@@ -61,3 +62,14 @@ func SafeGo(f interface{}, params ...interface{}) {
|
||||
funcValue.Call(paramsValue)
|
||||
}()
|
||||
}
|
||||
|
||||
// RandomString 生成随机字符串
|
||||
func RandomString(n int) string {
|
||||
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
length := len(letterBytes)
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
b[i] = letterBytes[rand.Intn(length)]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user