netmaker/controllers/regex.go
2022-12-13 11:32:07 +05:30

14 lines
315 B
Go

package controller
import (
"errors"
"regexp"
)
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)
}