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.
Check out the latest release at: https://github.com/jcuga/proxyblock/releases
Or, if you have a go workspace set up, simply build and run out of the box:
go get ./... go build proxyblock.go ./proxyblock
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 your
blacklist.txt configuration file.
You can optionally add the page URL to the whitelist, or visit it just one time
- 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...