interactive, configurable content-blocking proxy written in golang.
This code has reached full prototype status, it essentially does what my original idea was. I've used it on a daily basis to browse my usual news websites (with more detailed configurations than the whitelist/blacklist checked in here). Overall it generally works as expected. If HTTPS support is added, the UI given a makeover, and I add interactive whitelist/blacklist pattern editing from the controls, then I think this could be a pretty handy tool.
Or, if you have a go workspace set up, simply build and run out of the box:
go get ./...
go build proxyblock.go
Then just configure your browser to go thru the proxy.
You can modify the whitelist.txt and blacklist.txt files. These files contain a list of regexes (and optional comments that must start at the beginning of a line). URLs that match whitelist patterns will be allowed through while URLs that match blacklist patterns will be blocked. If a URL matches neither, it is allowed by default.
You can also manually allow a page by clicking the continue link on the proxy block response webpage.
How to Use
Once you've set your browser/OS to use the proxy you'll get a block page for any content that is blacklisted per yourblacklist.txt configuration file. You can optionally add the page URL to the whitelist, or visit it just one time only:
You can click to open the page controls and see more information about what was allowed/blocked.
You can manually click a row to unblock/block future requests for given URLs. Then when you visit the page again (just hit reload), you'll get the content.
By the way, you can move the page controls by clicking the up/down arrow. The proxy doesn't remember your preference between page loads though--that's one of the many TODOs.
Change/configure order of whitelist/blacklist rule application, currently the whitelist is applied first, then the blacklist.
HTTPS/Man-in-the-Middle proxying to control HTTPS content
better injected UI
wider browser support/testing for UI/behavior.
interactive whitelist/blacklist regexp tweaking
persisting exceptions between run
thread safety, currently there are goroutines all referencing a map, that's easy to fix.