{"id":50373703,"url":"https://github.com/structured-world/structured-public-domains","last_synced_at":"2026-05-30T08:30:31.457Z","repository":{"id":346686011,"uuid":"1191113543","full_name":"structured-world/structured-public-domains","owner":"structured-world","description":"Compact Public Suffix List (PSL) trie for Rust. 32KB embedded, O(depth) lookup. Auto-updated monthly.","archived":false,"fork":false,"pushed_at":"2026-04-02T18:52:06.000Z","size":162,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T06:16:13.863Z","etag":null,"topics":["domain-validation","psl","public-suffix-list","pure-rust","rust","trie"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/structured-world.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"structured-world"}},"created_at":"2026-03-24T23:44:56.000Z","updated_at":"2026-04-02T18:51:38.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/structured-world/structured-public-domains","commit_stats":null,"previous_names":["structured-world/structured-public-domains"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/structured-world/structured-public-domains","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/structured-world%2Fstructured-public-domains","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/structured-world%2Fstructured-public-domains/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/structured-world%2Fstructured-public-domains/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/structured-world%2Fstructured-public-domains/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/structured-world","download_url":"https://codeload.github.com/structured-world/structured-public-domains/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/structured-world%2Fstructured-public-domains/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33686018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["domain-validation","psl","public-suffix-list","pure-rust","rust","trie"],"created_at":"2026-05-30T08:30:30.405Z","updated_at":"2026-05-30T08:30:31.447Z","avatar_url":"https://github.com/structured-world.png","language":"Rust","funding_links":["https://github.com/sponsors/structured-world"],"categories":[],"sub_categories":[],"readme":"# structured-public-domains\n\nCompact Public Suffix List (PSL) for Rust.\n\n[![CI](https://github.com/structured-world/structured-public-domains/actions/workflows/ci.yml/badge.svg)](https://github.com/structured-world/structured-public-domains/actions/workflows/ci.yml)\n[![Crates.io](https://img.shields.io/crates/v/structured-public-domains.svg)](https://crates.io/crates/structured-public-domains)\n[![docs.rs](https://docs.rs/structured-public-domains/badge.svg)](https://docs.rs/structured-public-domains)\n[![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n\n- **Zero** runtime dependencies\n- **~108KB** embedded data (compact binary trie)\n- **~2.4M lookups/sec** on a single core (~420 ns per lookup)\n- **O(depth * log k)** trie traversal with per-node binary search (typically 2-3 steps)\n- Wildcard (`*.jp`) and exception (`!metro.tokyo.jp`) rules\n- Based on the official Public Suffix List (ICANN and private sections)\n- Checked daily against [publicsuffix.org](https://publicsuffix.org/)\n\n**Terminology:** A *public suffix* (e.g., `com`, `co.uk`) is the part of a domain under which users can register names. The *registrable domain* (eTLD+1) is one label above the suffix (e.g., `example.co.uk`).\n\n## Usage\n\n```rust\nuse structured_public_domains::{lookup, registrable_domain, is_known_suffix};\n\nlet info = lookup(\"www.example.co.uk\").unwrap();\nassert_eq!(info.suffix(), \"co.uk\");\nassert_eq!(info.registrable_domain(), Some(\"example.co.uk\"));\nassert!(info.is_known());\n\n// Helpers\nassert_eq!(registrable_domain(\"sub.example.com\"), Some(\"example.com\".to_string()));\nassert!(is_known_suffix(\"example.com\"));\n```\n\n## Performance\n\nBenchmarks on Apple M-series (criterion, `cargo bench`):\n\n| Benchmark | Time | Throughput |\n|-----------|------|-----------|\n| Simple (`example.com`) | ~420 ns | ~2.4M/s |\n| Nested (`www.example.co.uk`) | ~425 ns | ~2.4M/s |\n| Deep subdomain (`a.b.c.d.example.com`) | ~500 ns | ~2.0M/s |\n| Bare TLD (`com`) | ~195 ns | ~5.1M/s |\n| Private domain (`mysite.github.io`) | ~450 ns | ~2.2M/s |\n| Long chain (`very.deep...co.uk`) | ~500 ns | ~2.0M/s |\n\n**Runtime memory:** The PSL trie is parsed lazily on first call (`OnceLock`), then cached for the lifetime of the process. Runtime footprint is ~530 KB (sorted `Vec` children with binary search lookup). The ~108KB binary blob is embedded in the binary at compile time.\n\n## Why not `psl`?\n\n| | `psl` | `structured-public-domains` |\n|---|---|---|\n| Embedded data | ~876KB (codegen match tree) | **108KB** (compact binary trie) |\n| Source size | 2.4MB codegen | 300 lines + 108KB blob |\n| Runtime deps | None | **None** |\n| Runtime memory | N/A (static) | **~530KB** |\n| Lookup | O(depth) match tree | O(depth * log k) trie walk |\n| Auto-update | New crate version | Daily GitHub Actions check |\n\nBoth crates have comparable lookup speed and zero runtime dependencies. `structured-public-domains` has ~8x smaller embedded data and auto-updates daily via GitHub Actions with domain-level changelogs.\n\n## Support the Project\n\n\u003cdiv align=\"center\"\u003e\n\n![USDT TRC-20 Donation QR Code](assets/usdt-qr.svg)\n\nUSDT (TRC-20): `TFDsezHa1cBkoeZT5q2T49Wp66K8t2DmdA`\n\n\u003c/div\u003e\n\n## License\n\nApache License 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstructured-world%2Fstructured-public-domains","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstructured-world%2Fstructured-public-domains","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstructured-world%2Fstructured-public-domains/lists"}