Crates.io | nom-psl |
lib.rs | nom-psl |
version | 1.2.0 |
source | src |
created_at | 2018-10-25 16:35:52.630271 |
updated_at | 2019-06-03 16:45:03.008851 |
description | Fast public suffix list domain parsing, written in nom |
homepage | https://github.com/dwerner/nom-psl |
repository | https://github.com/dwerner/nom-psl |
max_upload_size | |
id | 92608 |
size | 232,645 |
The scope of this library is limited to finding the tld+1 of a given domain from the public suffix list.
PUBLIC_SUFFIX_LIST_FILE=somefile
- override which file will be loaded in place of public_suffix_list.dat
lazy_static! {
static ref LIST: List = {
let list = List::parse_source_file("public_suffix_list.dat", 10_000_000);
list.expect("unable to parse PSL file")
};
}
...
fn foo() {
let domain = "abc.one.two.example.co.uk";
let tldp1 = LIST.parse_domain(domain);
assert_eq!(tldp1, Some("example.co.uk"));
}