mvp
This commit is contained in:
@@ -2,7 +2,9 @@ package links
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
const codeLength = 5
|
||||
@@ -10,6 +12,7 @@ const codeLength = 5
|
||||
var (
|
||||
alphabet = "ABCDEFGHJKMNPQRSTUVWXYZ23456789"
|
||||
alphabetLength = big.NewInt(int64(len(alphabet)))
|
||||
ValidShortCode = regexp.MustCompile(fmt.Sprintf(`^/[%s]{%d}$`, alphabet, codeLength))
|
||||
)
|
||||
|
||||
func randInt() int {
|
||||
|
||||
Reference in New Issue
Block a user