mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
generate agent_secret for old users (#1021)
This commit is contained in:
@@ -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