Giter Site home page Giter Site logo

proxy's Introduction

proxy

An HTTP/HTTPS web proxy written in Node.js.

Overview

When the proxy recieves an HTTP request, it creates a request of its own for the data and responds to the client's request with the response to its own request.

On a 'connect' event, the proxy opens sockets to message the client and server, and pipes all communication from one socket to the other.

If the domain of the URL in a request is in the blacklist (the blacklist can be found in the config file), the requested data is not delivered.

When a HTTP response without the 'no-cache' cache-control header is delivered to the client from the proxy, it is also cached in the cache.json, so that it can be delivered straight from the cache if asked for again.

The cache.json is full of URL objects that have headers, status codes, and data. These attributes can be applied to a response to the client when a request is made for that URL.

When the proxy is run, the managment console starts up. The management console prints information about requests made to the proxy and can be used to query information or change the proxy's configuration. Caching information is printed to the management console in yellow. Denied requests are printed to the management console in red.

Requirements

This web proxy needs Node to run:

$npm install node

or

$brew install node

Usage

Running the Proxy

To run the proxy on the specified port and host ip from the config file:

$node proxy.js

Management Console Commands

To list the avaialable commands:

>help

To list the contents of the blacklist:

>blacklist

To add domains to the blacklist:

>blacklist <domain> {<domain>}

To remove domains from the blacklist:

>blacklistrm <domain> {<domain>}

To clear the cache:

>clearcache

To print the current port, host ip, and blacklist of the proxy:

>status

To change the port of the proxy:

>changeport <portnumber>

To change the host ip of the proxy:

>changehost <hostip>

To terminate the proxy:

>quit

Changes can be made to the config.json file while the proxy is running, and it will automatically reconfigure. This is not recommended though, as making changes via the management console ensures that the config.json remains in valid JSON format.

proxy's People

Contributors

nating avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.