Utopia Domains
Domain names split against the Public Suffix List.
This library is maintained by the Appwrite team.
Getting started
[]
= { = "https://github.com/appwrite/appwrite" }
Split a domain into its parts
Domain::new lower-cases the name and finds its public suffix. registerable is what someone actually owns: empty when the suffix is unknown.
use Domain;
let domain = new?;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert!;
Tell private platforms and test domains apart
The list also has a private section for platforms that hand out subdomains (github.io, cloud providers): each user's site is then its own registrable domain. Test and local names have no suffix at all.
use Domain;
let site = new?;
assert!;
assert_eq!;
let local = new?;
assert!;
assert_eq!;
Contributing
Test
Compare with PHP
The utopia PHP extension serves this crate as Utopia\Domains\Domain, which no longer has a PHP implementation. crates/extension/tests/run.sh runs packages/domains/tests on it in the development image.
Public Suffix List
data/public-suffix-list.txt is packages/domains/data/data.php in the crate's format. After refreshing the package's list, regenerate it from the repository root:
License
BSD-3-Clause. See LICENSE.