Here's the story -- I was impressed by the elegance and simplicity of bole5's (from OpenWrt forum) single-file adblocking script and started tinkering with it a long time ago. I kept working on it and now turned it into simple-adblock and luci-app-simple-adblock (with some help/suggestions from @hnyman and @dibdot).
There are a few things which differentiate this from another excellent adblocking solution by @dibdot:
- It's very fast.
- It understands hosts files and domains lists only (to keep it lean and fast).
- Everything is configurable from Web UI and uci commands.
- You can add your own domains to whitelist or blacklist.
- You can add URLs to your own blocked hosts or domains lists to block/whitelist.
- Requires no configuration for the download utility wherever you want to use wget/libopenssl or uclient-fetch/libustream-mbedtls.
- Installs dependencies automatically (DD/LEDE-default uclient-fetch libustream-mbedtls).
Just like @dibdot's solution:
- It uses dnsmasq to return "domain not found" (thanks @dibdot for the suggestion!) for blocked domains/hosts with no memory footprint for its own code .
- It defaults to DNS-hijacking, so if you have local devices on your network with hardcoded DNS servers, simple-adblock will force them to use your router DNS server (both IPv4 and IPv6) instead.
The actual speed will depend on your router model and connection speed, but because it uses simple sed substitutions to process the whole list in one go and because it backgrounds processing of already downloaded data while the next list is being downloaded, it's pretty quick.
Check out the README for more information/instructions.
Both packages are available from my repo: https://stangri.github.io/openwrt-repo/
I welcome any feedback!