adhole - 广告拦截器跟踪


BSD
跨平台
Google Go

软件简介

AdHole 是一个简单透明的广告拦截器跟踪,主要是提供给个人使用。

It works by providing two elements: first a DNS server that, based on a list
of domains, either relies the query to a real server, or returns its own IP
address; and a micro HTTP server that serves an empty GIF image for any
request. As such its functionality is akin to
AdBlock,
but less pretty (you’ll probably see empty space where ads used to be) and
completely transparent (i.e. will work for any browser, on any OS on any
machine, locally or over any network). Note that you can just as well block
any domains.

I use AdHole in ‘production’ on my
RaspberryPi-powered WiFi router, where it
provides ad and tracking blocking to all my wireless toys.

My programming goal was to make it as simple and minimal as possible.
Therefore instead of a full DNS stack (and especially parsing) I work directly
on []byte slices and try to reuse the data already on hand. It was also a
nice little adventure in dealing with binary protocols the low-level way.

使用方法:

Usage: ./adhole [options] key upstream proxy list.txt

key      - password used for /debug actions protection
upstream - real upstream DNS address, e.g. 8.8.8.8
proxy    - servers' bind address, e.g. 127.0.0.1
list.txt - text file with domains to block

  -dport=53: DNS server port
  -hport=80: HTTP server port
  -t=5s: upstream query timeout
  -v=false: be verbose