netmaker/controllers/regex.go

14 lines
315 B
Go
Raw Normal View History

package controller
import (
"errors"
"regexp"
)
2022-12-13 14:02:07 +08:00
var errInvalidExtClientID = errors.New("ext client ID must be alphanumderic and/or dashes")
// allow only dashes and alphaneumeric for ext client and node names
func validName(name string) bool {
return regexp.MustCompile("^[a-zA-Z0-9-]+$").MatchString(name)
}