Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-adblocker-api

A simple HTTP API wrapping the brave/adblock-rust engine. You send it a URL, it tells you if it should be blocked.

How it works

Loads two filter lists on startup:

  • easylist.txt — used by default
  • custom-list.txt — used when you pass "custom": true in the request

Running

cargo run

Starts on http://0.0.0.0:8080. You'll need easylist.txt and custom-list.txt in the working directory.

Or with Docker:

docker build -t rust-adblocker-api .
docker run -p 8080:8080 rust-adblocker-api

Endpoints

GET /status

{ "status": "UP" }

POST /filter

{
  "url": "https://ads.example.com/banner.png",
  "request_type": "image",
  "referer": "https://example.com",
  "custom": false
}

Response:

{ "blocked": true }

request_type can be image, script, document, stylesheet, etc. custom is optional, defaults to false.

Tests

cargo test

Includes a stress test that fires 1000 concurrent requests.

About

API wrapper for Brave's rust adblocker engine

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages