netpkt/psl.rs#
Source: lib/netpkt/psl.rs
psl -- the Public Suffix List (publicsuffix.org): where a name stops being one that a single
party registers ("co.uk", "github.io", "*.ck" but not "www.ck")
public_suffix(host) -> &str "example.co.uk" -> "co.uk", "a.b.github.io" -> "github.io";
a name the list does not know: its last label (the rule *)
registrable_domain(host) -> Option<&str> one label more ("example.co.uk"); None for a public
suffix itself, an address, or ""
is_public_suffix(name) -> bool
LIST_COMMIT, LIST_DATE the list the table was made from (tools/psl_gen.py)
The names are taken as they come: lower case, A-labels ("xn--..."), without a dot at the end
(cookie::canonical_host gives that). Both sections of the list count, ICANN and PRIVATE, as
browsers take them for cookies. The table (psl_data.rs, MPL-2.0) holds the rules as one
sorted string; a lookup is a binary search per label.
/// the commit of publicsuffix/list the table was generated from
LIST_COMMIT: &str = data::COMMIT
/// that commit's date
LIST_DATE: &str = data::DATE
fn public_suffix(host: &str) -> &strthe public suffix of a name (the whole of it when it is one; "" for "" or an address)fn registrable_domain(host: &str) -> Option<&str>the public suffix and one label more: what a party registers ("example.co.uk"); None when the name is a public suffix itself, an address, or not a namefn is_public_suffix(name: &str) -> boolwhether a name is a public suffix ("com", "co.uk", "github.io", "foo.ck"; not "www.ck")