Files
ziti/eid/id.go
T
Andrew Martinez 0ec43c5625 use custom alphabet for id generation
Using underscores causes issues with common name fields as they cannot
have underscores.
2020-11-20 15:31:21 -05:00

20 lines
330 B
Go

package eid
import (
"github.com/teris-io/shortid"
"math/rand"
)
const Alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-"
var idGenerator *shortid.Shortid
func init() {
idGenerator = shortid.MustNew(0, Alphabet, rand.Uint64())
}
func New() string {
id, _ := idGenerator.Generate()
return id
}