Skip to main content

Crate structured_public_domains

Crate structured_public_domains 

Source
Expand description

§structured-public-domains

Compact Public Suffix List (PSL) for Rust.

  • ~35KB embedded data (JSON trie compressed with zstd)
  • O(depth) trie walk lookup (typically 2-3 steps)
  • Wildcard (*.jp) and exception (!metro.tokyo.jp) rules
  • Includes ICANN and private domains from the Public Suffix List
  • Auto-updated monthly from publicsuffix.org

§Example

use structured_public_domains::lookup;

let info = lookup("www.example.co.uk").unwrap();
assert_eq!(info.suffix(), "co.uk");
assert_eq!(info.registrable_domain(), Some("example.co.uk"));
assert!(info.is_known());

Structs§

DomainInfo
Result of a PSL lookup.

Functions§

is_known_suffix
Check if a domain’s suffix is a known entry in the PSL.
lookup
Look up a domain in the Public Suffix List.
registrable_domain
Extract the registrable domain (eTLD+1) from a domain.