From 9bb57aebfefb37792bf401aa5e8951b6dd6c2d38 Mon Sep 17 00:00:00 2001 From: jaketothepast Date: Sun, 27 Jan 2019 11:58:48 -0500 Subject: [PATCH] Updating some documentation, README --- README.md | 10 ++++++---- index.js | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2cc7740..1078408 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ 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. -2. It will block traffic after it's detected that you've been on a certain site for too long. +2. It will block traffic after it's detected that you've visited a site too much. In the future I would like it to: @@ -38,6 +38,8 @@ To run them, install the requirements with Pip, then run 4. Get Vagrantfile so can test with an actual browser that asks for a proxy. 5. ~~Implement forwarding an HTTP request to the desired host after proxy request.~~ 6. ~~Return response from forwarded HTTP request to client.~~ -7. Add some sort of backing store for keeping track of how many requests go to certain hosts. - - Adding sqlite. -8. Add blocking for going over time limits on hosts. \ No newline at end of file +7. ~~Add some sort of backing store for keeping track of how many requests go to certain hosts.~~ + - ~~Adding sqlite.~~ +8. Add blocking for going over ~~time limits~~ *visit limits* on hosts. +9. Add some sort of configuration management, through a config file, and eventually a web interface. +10. HTTPS support (ooh, ahh). \ No newline at end of file diff --git a/index.js b/index.js index 82dab04..da48cfe 100644 --- a/index.js +++ b/index.js @@ -33,13 +33,14 @@ const processRequest = (request, response) => { // Set up an end handler for the socket connection. request.on("end", () => { body = Buffer.concat(body).toString(); - logger.info({message: "Got a message!"}); logger.info({message: "Requesting: " + req.url}); const hostUrl = new url.URL(req.url); myDb.visitHost(hostUrl.hostname); // Complicated line of JS to forward request, and pipe it to the // response object. + // + // Uses closures to ensure that both req and res are what I want. req.pipe(http.request(req.url, (resp) => {resp.pipe(res)})); }); }