Code Monkey home page Code Monkey logo

adblock-rust's Introduction

adblock-rust

crates.io npmjs.com docs.rs Build Status License

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!

Getting started

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.

Optional features

The following cargo features can be used to tweak adblock-rust to best fit your use-case.

CSS validation during rule parsing (css-validation)

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)

Enabling the 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 (embedded-domain-resolver)

By default, 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 (resource-assembler)

adblock-rust uses uBlock Origin-compatible resources for scriptlet injection and redirect rules. The resource-assembler feature allows adblock-rust to parse these resources directly from the file formats used by the uBlock Origin repository.

Thread safety (object-pooling, unsync-regex-caching)

The object-pooling and 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.

adblock-rust's People

Contributors

antonok-edm avatar atuchin-m avatar ryanbr avatar bbondy avatar dependabot[bot] avatar denosaurtrain avatar mihaiplesa avatar pes10k avatar ankeleralph avatar arnidagur avatar jumde avatar snyderp avatar shivankaul avatar andriusa avatar rillian avatar hawkeye116477 avatar rushmorem avatar bsclifton avatar linhkikuchi avatar sbdchd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.