cmd/tailscale,ipn,tailcfg: add tailscale advertise subcommand behind envknob (#13734)

Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
Naman Sood
2024-10-16 19:08:06 -04:00
committed by GitHub
parent d32d742af0
commit 22c89fcb19
9 changed files with 130 additions and 2 deletions
+15
View File
@@ -651,6 +651,21 @@ func CheckTag(tag string) error {
return nil
}
// CheckServiceName validates svc for use as a service name.
// We only allow valid DNS labels, since the expectation is that these will be
// used as parts of domain names.
func CheckServiceName(svc string) error {
var ok bool
svc, ok = strings.CutPrefix(svc, "svc:")
if !ok {
return errors.New("services must start with 'svc:'")
}
if svc == "" {
return errors.New("service names must not be empty")
}
return dnsname.ValidLabel(svc)
}
// CheckRequestTags checks that all of h.RequestTags are valid.
func (h *Hostinfo) CheckRequestTags() error {
if h == nil {