INNER CODE UNIT · Rust

is_valid_domain

ovexro/dockpanel · panel/backend/src/routes/mod.rs:91

pub fn is_valid_domain(domain: &str) -> bool {
    if domain.is_empty() || domain.len() > 253 {
        return false;
    }
    domain.split('.').all(|part| {
        !part.is_empty()
            && part.len() <= 63
            && part
                .chars()
                .all(|c| c.is_ascii_alphanumeric() || c == '-')
            && !part.starts_with('-')
            && !part.ends_with('-')
    }) && domain.contains('.')
}

/// Reserved control-plane domains that a tenant must never be able to claim,
/// alias onto, clone onto, or rename onto. Factored out so every
/// domain-introducing path (create / clone / rename / add_alias) shares ONE

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…