A simple HTTP API wrapping the brave/adblock-rust engine. You send it a URL, it tells you if it should be blocked.
Loads two filter lists on startup:
easylist.txt— used by defaultcustom-list.txt— used when you pass"custom": truein the request
cargo runStarts 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{ "status": "UP" }{
"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.
cargo testIncludes a stress test that fires 1000 concurrent requests.