2019-01-25 03:07:42 +00:00
|
|
|
# Node HTTP Proxy
|
|
|
|
|
2019-01-25 03:37:42 +00:00
|
|
|
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.
|
|
|
|
|
|
|
|
1. It will monitor application-level traffic (anything over HTTP/HTTPS) - and log it.
|
2019-01-27 16:58:48 +00:00
|
|
|
2. It will block traffic after it's detected that you've visited a site too much.
|
2019-01-25 03:37:42 +00:00
|
|
|
|
|
|
|
In the future I would like it to:
|
|
|
|
|
|
|
|
1. Block traffic based on pre-configured block rules.
|
|
|
|
2. Attempt to block any content it deems dangerous.
|
|
|
|
3. Provide a web interface for configuration management.
|
|
|
|
4. 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!
|
2019-01-25 03:09:42 +00:00
|
|
|
|
|
|
|
# Testing
|
|
|
|
|
2019-01-25 03:37:42 +00:00
|
|
|
To test, can either spin up the vagrant instance, or utilize the unit tests.
|
|
|
|
|
2019-01-26 12:54:31 +00:00
|
|
|
# Testing Locally
|
|
|
|
|
|
|
|
The directory `./test` includes Python based tests intended to stress the proxy.
|
|
|
|
To run them, install the requirements with Pip, then run
|
2019-01-26 13:18:36 +00:00
|
|
|
`python3 test_proxy.py`. Ensure the proxy is running by running `node index.js` before testing.
|
2019-01-26 12:54:31 +00:00
|
|
|
|
2019-01-25 03:37:42 +00:00
|
|
|
# TODO
|
|
|
|
|
2019-01-26 13:18:36 +00:00
|
|
|
1. ~~Setup a server that listens on a port~~
|
|
|
|
2. ~~Write a rudimentary parsing routine.~~
|
|
|
|
3. Get Jest tests set up for the parsing routine.
|
|
|
|
4. Get Vagrantfile so can test with an actual browser that asks for a proxy.
|
2019-01-26 18:32:04 +00:00
|
|
|
5. ~~Implement forwarding an HTTP request to the desired host after proxy request.~~
|
|
|
|
6. ~~Return response from forwarded HTTP request to client.~~
|
2019-01-27 16:58:48 +00:00
|
|
|
7. ~~Add some sort of backing store for keeping track of how many requests go to certain hosts.~~
|
|
|
|
- ~~Adding sqlite.~~
|
2019-01-28 02:29:50 +00:00
|
|
|
8. ~~Add blocking for going over ~~time limits~~ *visit limits* on hosts.~~
|
2019-01-27 16:58:48 +00:00
|
|
|
9. Add some sort of configuration management, through a config file, and eventually a web interface.
|
|
|
|
10. HTTPS support (ooh, ahh).
|