You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO: unify actor/atespace validation across the control API RPCs — some only
37
-
// reject empty strings (get/pause/resume/suspend), others run the full validator.
38
-
39
-
// ValidateActorID validates whether the provided actor ID is valid or not.
40
-
// Actor IDs must be valid DNS-1123 labels.
41
-
//
42
-
// 1. Must be between 1 and 63 characters in length.
43
-
// 2. Must start with a lower-case alphanumeric character (a-z, 0-9).
44
-
// 3. Must contain only lower-case alphanumeric characters and hyphens (a-z, 0-9, -).
45
-
// 4. Must end with a lower-case alphanumeric character (cannot end with a hyphen).
46
-
funcValidateActorID(idstring) error {
47
-
iflen(id) >63 {
48
-
returnfmt.Errorf("invalid actor_id: must be no more than 63 characters")
49
-
}
50
-
if!actorIDRegex.MatchString(id) {
51
-
returnfmt.Errorf("invalid actor_id: must start and end with a lower case alphanumeric character, and consist only of lower case alphanumeric characters or '-'")
52
-
}
53
-
returnnil
54
-
}
55
-
56
-
// ValidateAtespace validates whether the provided atespace name is valid. An
57
-
// atespace must be a valid DNS-1123 label (same rules as an actor ID above).
58
-
funcValidateAtespace(atespacestring) error {
59
-
iflen(atespace) >63 {
60
-
returnfmt.Errorf("invalid atespace: must be no more than 63 characters")
61
-
}
62
-
if!actorIDRegex.MatchString(atespace) {
63
-
returnfmt.Errorf("invalid atespace: must start and end with a lower case alphanumeric character, and consist only of lower case alphanumeric characters or '-'")
64
-
}
65
-
returnnil
66
-
}
67
-
68
34
// ActorDNSName returns the mesh DNS name an actor is reachable at:
69
-
// "<actor_id>.<atespace>.actors.resources.substrate.ate.dev". The atespace is
70
-
// part of the name because an actor id is only unique within its atespace.
0 commit comments