Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
spider_firewall
A Rust library to shield your system from malicious and unwanted websites by categorizing and blocking them.
Installation
Add spider_firewall to your Cargo project with:
Size Tiers
The small tier is enabled by default. Enable medium or large for broader coverage — each tier includes all sources from the tier(s) below it.
| Tier | FST Size | Focus | Feature Flag |
|---|---|---|---|
| small (default) | ~13 MB | Ads, tracking, malware, phishing, scams, adult/porn | small |
| medium | ~26 MB | + ransomware, fraud, abuse, threat intel, extended phishing | medium |
| large | ~52 MB | + redirect/typosquatting, extended ads/tracking, full URLhaus | large |
# Default — small tier, all categories:
= "2.35"
# Medium tier:
= { = "2.35", = ["medium"] }
# Large tier:
= { = "2.35", = ["large"] }
# Small tier, only bad + ads (no tracking/gambling):
= { = "2.35", = false, = ["default-tls", "bad", "ads", "small"] }
Category Features
Categories can be toggled independently (all enabled by default):
| Feature | Description |
|---|---|
bad |
Malware, phishing, scams, fraud, ransomware, abuse |
ads |
Advertising domains |
tracking |
Tracking and analytics domains |
gambling |
Gambling domains |
ip |
Known-bad IPv4 network ranges (Spamhaus DROP) — opt-in, see IP blocking |
Usage
Checking for Bad Websites
You can check if a website is part of the bad websites list using the is_bad_website_url function.
use is_bad_website_url;
Adding a Custom Firewall
You can add your own websites to the block list using the define_firewall! macro. This allows you to categorize new websites under a predefined or new category.
use is_bad_website_url;
// Add "bad.com" to a custom category.
define_firewall!;
Example with Custom Ads List
You can specify websites to be blocked under specific categories such as "ads".
use is_ad_website_url;
// Add "ads.com" to the ads category.
define_firewall!;
IP blocking
Enable the opt-in ip feature to also block known-bad IPv4 network ranges. The ranges are
embedded at build time from the Spamhaus DROP list and matched
via longest-prefix (binary) search. IPv6 currently always returns false.
= { = "2.35", = ["ip"] }
use ;
The feed is rate-limited (~1 download/day) and revocable, so it is fetched non-fatally at build
time — a failed or rate-limited fetch yields zero ranges rather than breaking the build, and emits a
cargo:warning reporting the embedded range count (or that IP blocking is inactive).
For production builds where IP blocking must not silently disable on a rate-limited fetch, set
SPIDER_FIREWALL_IP_STRICT=1: the build then fails loudly if the DROP fetch returns zero ranges
(instead of shipping with IP blocking inactive). Retry once the ~1/day limit resets.
Attribution: IP range data is provided by The Spamhaus Project under the Spamhaus DROP terms (free for any use, attribution required). © The Spamhaus Project.
Blocklist Sources
Small (default)
| Source | Categories | License |
|---|---|---|
| ShadowWhisperer/BlockLists | bad, ads, tracking, gambling | MIT |
| badmojr/1Hosts Lite | ads, tracking | MPL-2.0 |
| spider-rs/bad_websites | bad | MIT |
| Steven Black Unified Hosts | bad | MIT |
| Block List Project — Malware | bad | MIT |
| Block List Project — Phishing | bad | MIT |
| Block List Project — Scam | bad | MIT |
| URLhaus Filter (domains) | bad | CC0/MIT |
| Steven Black Hosts — Porn | bad (adult/porn) | MIT |
| malware-filter — Phishing | bad (phishing) | CC0/MIT |
Medium (adds)
| Source | Categories | License |
|---|---|---|
| Block List Project — Ransomware | bad | MIT |
| Block List Project — Fraud | bad | MIT |
| Block List Project — Abuse | bad | MIT |
| Phishing.Database — Active Domains | bad | MIT |
| Stamparm/maltrail — Suspicious | bad | MIT |
| phishdestroy/destroylist — Primary Active | bad (phishing/scam) | MIT |
Large (adds)
| Source | Categories | License |
|---|---|---|
| Block List Project — Redirect | bad | MIT |
| Block List Project — Tracking | tracking | MIT |
| Block List Project — Ads | ads | MIT |
| Stamparm/maltrail — Malware | bad | MIT |
| abuse.ch URLhaus Hostfile | bad | CC0 |
Build Time
The initial build can take longer, approximately 5-10 minutes, as it may involve compiling dependencies and generating necessary data files.
Contributing
Contributions and improvements are welcome. Feel free to open issues or submit pull requests on the GitHub repository.
License
This project is licensed under the MIT License.