lib | ||
test | ||
.gitignore | ||
index.js | ||
index.test.js | ||
package-lock.json | ||
package.json | ||
README.md |
Node HTTP Proxy
This project is an HTTP proxy, written in Node.js.
I wrote this because I deal with proxies at work all the time, and wanted to write one as an exercise. I chose Node.js due to the event-driven architecture lending itself well to networking applications and because I am familiar with the language.
My goal for this project is to have it be easy to spin up, and compatible with major browsers. It will do 2 things.
- It will monitor application-level traffic (anything over HTTP/HTTPS) - and log it.
- It will block traffic after it's detected that you've visited a site too much.
In the future I would like it to:
- Block traffic based on pre-configured block rules.
- Attempt to block any content it deems dangerous.
- Provide a web interface for configuration management.
- Provide a configuration file.
So in reality, it will be a tool to help monitor your internet usage and block you from spending too much time on any particular site!
Testing
To test, can either spin up the vagrant instance, or utilize the unit tests.
Testing Locally
The directory ./test
includes Python based tests intended to stress the proxy.
To run them, install the requirements with Pip, then run
python3 test_proxy.py
. Ensure the proxy is running by running node index.js
before testing.
TODO
Setup a server that listens on a portWrite a rudimentary parsing routine.- Get Jest tests set up for the parsing routine.
- Get Vagrantfile so can test with an actual browser that asks for a proxy.
Implement forwarding an HTTP request to the desired host after proxy request.Return response from forwarded HTTP request to client.Add some sort of backing store for keeping track of how many requests go to certain hosts.Adding sqlite.
Add blocking for going overtime limitsvisit limits on hosts.- Add some sort of configuration management, through a config file, and eventually a web interface.
- HTTPS support (ooh, ahh).