mirror of
https://github.com/juanfont/headscale.git
synced 2025-01-19 10:20:05 +09:00
util: correctly truncate randomurl string
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
78a70b455d
commit
01fccbc3e8
1 changed files with 2 additions and 1 deletions
|
@ -32,7 +32,8 @@ func GenerateRandomBytes(n int) ([]byte, error) {
|
|||
func GenerateRandomStringURLSafe(n int) (string, error) {
|
||||
b, err := GenerateRandomBytes(n)
|
||||
|
||||
return base64.RawURLEncoding.EncodeToString(b), err
|
||||
uenc := base64.RawURLEncoding.EncodeToString(b)
|
||||
return uenc[:n], err
|
||||
}
|
||||
|
||||
// GenerateRandomStringDNSSafe returns a DNS-safe
|
||||
|
|
Loading…
Reference in a new issue