mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-11-04 16:40:21 +00:00
generate agent_secret for old users (#1021)
This commit is contained in:
1 parent
79884c781a
commit
9ee5595da7
4 files changed
+31
-8
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"cmp"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"iter"
|
||||
"maps"
|
||||
"math/big"
|
||||
@@ -82,6 +83,14 @@ func GenerateRandomString(n int) (string, error) {
|
||||
return string(ret), nil
|
||||
}
|
||||
|
||||
func MustGenerateRandomString(n int) string {
|
||||
str, err := GenerateRandomString(n)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("MustGenerateRandomString: %v", err))
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
func Uint64SubInt64(a uint64, b int64) uint64 {
|
||||
if b < 0 {
|
||||
return a + uint64(-b)
|
||||
|
||||
Reference in new issue
Block a user