Function validate_dns

Source
pub fn validate_dns<F: FnOnce(String) -> PrincipalError>(
    name: &str,
    max_length: usize,
    map_err: F,
) -> Result<(), PrincipalError>
Expand description

Verify that a DNS name meets Scratchstack requirements.

DNS names may have multiple components separated by a dot (.). Each component must be between 1 and 63 characters. The total length of the name must be less than the max_length argument.

Components may contain ASCII alphanumeric characters, hyphens (-), and underscores (_). A component may not begin or end with a hyphen, and may not contain two consecutive hyphens.