validator
ModuleValidators of domain names against the Public Suffix List.
Contents
Structs
ApexDomainA public domain that is its own apex (`example.co.uk`, not `blog.example.co.uk`). A URL is judged by its host.PublicDomainA domain under a known public suffix, or one of the domains allowed with `PublicDomain::allow`. A URL is judged by its host.RegistrableDomainA lower-case domain name under a known public suffix (`example.com`, `app.example.com`), that is not a public suffix itself (`com`, `co.uk`, `github.io`), an IP address, a URL or a single label like `localhost`.use utopia_domains::validator::ApexDomain;Rust
pub struct ApexDomainA public domain that is its own apex (example.co.uk, not
blog.example.co.uk). A URL is judged by its host.
Rust
use utopia_domains::validator::ApexDomain;
use utopia_validators::Validator;
assert!(ApexDomain.is_valid(&"bbc.co.uk".into()));
assert!(!ApexDomain.is_valid(&"blog.bbc.co.uk".into()));Also implements
Validator.use utopia_domains::validator::PublicDomain;Rust
pub struct PublicDomainA domain under a known public suffix, or one of the domains allowed with
PublicDomain::allow. A URL is judged by its host.
Rust
use utopia_domains::validator::PublicDomain;
use utopia_validators::Validator;
let validator = PublicDomain;
assert!(validator.is_valid(&"example.com".into()));
assert!(validator.is_valid(&"https://www.google.com".into()));
assert!(!validator.is_valid(&"wiki.team.local".into()));Also implements
Validator.use utopia_domains::validator::RegistrableDomain;Rust
pub struct RegistrableDomainA lower-case domain name under a known public suffix (example.com,
app.example.com), that is not a public suffix itself (com, co.uk,
github.io), an IP address, a URL or a single label like localhost.
Rust
use utopia_domains::validator::RegistrableDomain;
use utopia_validators::Validator;
assert!(RegistrableDomain.is_valid(&"app.example.com".into()));
assert!(!RegistrableDomain.is_valid(&"github.io".into()));
assert!(!RegistrableDomain.is_valid(&"Example.com".into()));Also implements
Validator.