|0.7.7||Mar 15, 2023|
|0.7.5||Feb 22, 2023|
|0.6.1||Dec 12, 2022|
|0.6.0||Nov 30, 2022|
|0.1.28||Jul 22, 2019|
#371 in Text processing
6,991 downloads per month
Used in adblock-rust-server
Putting you back in control of your browsing experience.
adblock-rust is the engine powering Brave's native adblocker, available as a library for anyone to use. It features:
- Network blocking
- Cosmetic filtering
- Resource replacements
- Hosts syntax
- uBlock Origin syntax extensions
- iOS content-blocking syntax conversion
- Compiling to native code or WASM
- Rust bindings (crates)
- JS bindings (npm)
- Community-maintained Python bindings (pypi)
- High performance!
adblock-rust is used in several projects, including browsers, research tools, and proxies.
It may be a good fit for yours, too!
See docs.rs for detailed API documentation.
Also check the Rust example or the NodeJS example.
cargo features can be used to tweak
adblock-rust to best fit your use-case.
CSS validation during rule parsing (
When parsing cosmetic filter rules, it's possible to include a built-in implementation of CSS validation (through the selectors and cssparser crates) by enabling the
css-validation feature. This will cause
adblock-rust to reject cosmetic filter rules with invalid CSS syntax.
Content blocking format translation (
content-blocking feature gives
adblock-rust support for conversion of standard ABP-style rules into Apple's content-blocking format, which can be exported for use on iOS and macOS platforms.
External domain resolution (
adblock-rust ships with a built-in domain resolution implementation (through the addr crate) that will generally suffice for standalone use-cases. For more advanced use-cases, disabling the
embedded-domain-resolver feature will allow
adblock-rust to use an external domain resolution implementation instead. This is extremely useful to reduce binary bloat and improve consistency when embedding
adblock-rust within a browser.
Parsing resources from uBlock Origin's formats (
adblock-rust uses uBlock Origin-compatible resources for scriptlet injection and redirect rules.
resource-assembler feature allows
adblock-rust to parse these resources directly from the file formats used by the uBlock Origin repository.
Thread safety (
unsync-regex-caching features enable optimizations for rule matching speed and the amount of memory used by the engine.
These features can be disabled to make the engine
Send + Sync, although it is recommended to only access the engine on a single thread to maintain optimal performance.