mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 17:29:15 +08:00
Extclient NET-63x (#2286)
* model changes * additional fields for extclient create * add DNS to extclient config * extclient name checks * update extclient * nmctl extclient * final tweaks * review comments * add extclientdns to node on ingress creation * fix to add ingress dns to api (#2296) --------- Co-authored-by: Aceix <aceixsmartX@gmail.com>
This commit is contained in:
@@ -6,11 +6,23 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
errInvalidExtClientPubKey = errors.New("incorrect ext client public key")
|
||||
errInvalidExtClientID = errors.New("ext client ID must be alphanumderic and/or dashes")
|
||||
errInvalidExtClientPubKey = errors.New("incorrect ext client public key")
|
||||
errInvalidExtClientID = errors.New("ext client ID must be alphanumderic and/or dashes and less that 15 chars")
|
||||
errInvalidExtClientExtraIP = errors.New("ext client extra ip must be a valid cidr")
|
||||
errInvalidExtClientDNS = errors.New("ext client dns must be a valid ip address")
|
||||
)
|
||||
|
||||
// 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)
|
||||
reg, err := regexp.Compile("^[a-zA-Z0-9-]+$")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if !reg.MatchString(name) {
|
||||
return false
|
||||
}
|
||||
if len(name) > 15 {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
Reference in New Issue
Block a user