MCPcopy Index your code
hub / github.com/coder/coder / ValidateWorkspaceHostnameSuffix

Function ValidateWorkspaceHostnameSuffix

codersdk/deployment.go:736–751  ·  view source on GitHub ↗

ValidateWorkspaceHostnameSuffix validates a deployment-provided SSH hostname suffix before it is made available to clients.

(suffix string)

Source from the content-addressed store, hash-verified

734// ValidateWorkspaceHostnameSuffix validates a deployment-provided SSH hostname
735// suffix before it is made available to clients.
736func ValidateWorkspaceHostnameSuffix(suffix string) error {
737 // The suffix is implicitly prefixed with a dot when matching, so a leading
738 // dot is a config error: it forces the suffix to be a separate DNS label
739 // rather than an ordinary string suffix. E.g. "coder" matches "en.coder"
740 // but not "encoder".
741 if strings.HasPrefix(suffix, ".") {
742 return xerrors.Errorf("workspace hostname suffix %q must not start with a leading dot", suffix)
743 }
744 if strings.ContainsAny(suffix, "*?") {
745 return xerrors.Errorf("workspace hostname suffix %q must not contain glob characters", suffix)
746 }
747 if !isSingleHostPatternToken(suffix) {
748 return xerrors.Errorf("workspace hostname suffix %q must not contain whitespace or control characters", suffix)
749 }
750 return nil
751}
752
753// ValidateWorkspaceHostnamePrefix validates a deployment-provided SSH hostname
754// prefix before it is made available to clients. Unlike the suffix, a prefix

Callers 2

ValidateMethod · 0.85

Calls 2

isSingleHostPatternTokenFunction · 0.85
ErrorfMethod · 0.45

Tested by 1