Giter Club home page Giter Club logo

node-spdy-proxy's Introduction

node-spdy-proxy

node-spdy-proxy is a network-optimizing proxy server utility based on node-spdy.

Features

  • Works standalone or as a part of other applications
  • SPDY v2/3 capable, with graceful degredation to normal HTTPS
  • Full-feature support for HTTP/HTTPS, correctly handles websocket upgrades
  • Client authentication by certificates
  • Host/IP blacklist support
  • Client management based on pubkey fingerprints
  • Extensive logging and debugging information

Why SPDY?

SPDY is the next generation HTTP/S. Over a high-latency channel, SPDY can effectively reduce roundtrips and improve network responsiveness. It adds header compression, stream multiplexing and flow control to HTTP/S. These features enables SPDY to become a great candidate for network-optimizing proxies.

###What is the Purpose of node-spdy-proxy?

node-spdy-proxy is a network-optimizing proxy, similar to the ones deployed on Amazon Silk and the latest version of Google Chrome for Android. It improves network responsiveness over high-latency channels (such as satellite or wireless connections) by acting as the gateway between the client behind these channels and the datacenter.

Install

Make sure you are under the source code directory, and then

> npm install

Then run the server:

> ./runserver

Note that if you are using port < 1024, you need to have superuser privileges, so you may have to do:

> sudo ./runserver

Usage

runserver starts the proxy server with the configurations file provided. If no config file is provided, It reads proxy.conf, and falls back to default settings if proxy.conf doesn't exist.

Command-line Usage

  Usage: runserver [config_file]

  Options:

    -h, --help                 output usage information
    -o, --overrides [options]  specify extra options, overrides the config file
    -p, --port [port_number]   Bind server to the specified port, overrides other configurations
    -V, --credits              Print software version and credits

Configurations

Configurations are specified in proxy.conf. Detailed explanation for each option is as follows,

  • DEBUG: whether to enable debug mode, defaults to true

  • log_file: server log output, defaults to proxy.log

  • ip_blacklist: the path to the IP blacklist file. The file must be a plain-text file with one IP address on each line terminated with \n. If set to null, this features is disabled. Defaults to null

  • host_blacklist: the path to the host blacklist file. The file must be a plain-text file with one host name on each line terminated with \n. If set to null, this features is disabled. Defaults to null

  • user_ca: the path to the certificate of a certificate authority. When enabled, each client must provide a certificate signed by this CA. Unauthenticated clients are disconnected. If set to null, this features is disabled. Defaults to null

  • user_db: the path to a JSON file that identifies each user by the fingerprint of their certificate. The username will then appear in the log file each time a proxy request is sent. If set to null, every user will bear the name anonymous. Defaults to null

  • security:

    • key: path to the TLS key file, defaults to key.pem

    • cert: path to the TLS certificate file, defaults to cert.pem

  • declineHTTP: if set to true, the server will decline HTTP connections. Defaults to false

  • timeout: Remote server timeout in milliseconds, the default is 10000ms. Note that it only applies to new connections.

  • maxConnections: Maximum number of connections, defaults to 100

  • noDelay: Whether connections should not be buffered, defaults to true

  • keepAlive: Whether to allow HTTP connections to keep-alive, defaults to true

  • host: hostname of the proxy server, defaults to localhost

  • ip: IP address of the proxy server, defaults to 127.0.0.1

  • port: listening port, defaults to 8080.

node-spdy-proxy's People

Contributors

m-messiah avatar xkxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-spdy-proxy's Issues

./runserver encountered error,how to fix it?

hi.

root@ar:~/node-spdy-proxy# ./runserver
util.js:948
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'superCtor', 'Function');
^

TypeError [ERR_INVALID_ARG_TYPE]: The "superCtor" argument must be of type Function
at Object.inherits (util.js:948:11)
at Object. (/root/node-spdy-proxy/node_modules/spdy/lib/spdy/server.js:478:6)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object. (/root/node-spdy-proxy/node_modules/spdy/lib/spdy.js:31:15)
root@ar:~/node-spdy-proxy#

HTTPS support

The proxy works great, but https requests are not answered by the server. I see that there is support for HTTP CONNECT method in the code, but this codepath is not reached at all.

Doesn't work with Nodejs v0.11.x

Hi,

when using the latest dev version node-spdy-proxy stops working:

 ⚡ ~/dev/test/node-spdy-proxy (master) nvm run v0.11.4 --nouse-idle-notification --expose-gc --max-new-space-size=2048 --max-old-space-size=14336  runserver
Running node v0.11.4
4 Aug 22:30:08 - Server up listening at localhost:9090
4 Aug 22:35:51 - client
4 Aug 22:35:51 - [uncaughtException]: Cannot read property 'remoteAddress' of undefined
4 Aug 22:35:51 - [uncaughtException]: Cannot read property 'IP' of undefined

The issue lies within server.js:

var connectionHandler = function(client) {
    var debug, connection, IP, conID, user;
    debug = this.debug;
    connection = client.socket;
    debug("client", client.method)
    IP = connection.IP = connection.remoteAddress;

client.socket is empty.

Thanks.

Cannot find commander

I am getting this error

hdavy2002@zip:~/node-spdy-proxy-master$ sudo ./runserver proxy.conf

module.js:340
throw err;
^
Error: Cannot find module 'commander'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/home/hdavy2002/node-spdy-proxy-master/runserver:3:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
hdavy2002@zip:~/node-spdy-proxy-master$

Memory Leak

Streaming Video content esp. Youtube causes memory usage to jump from ~50MB to ~>100MB in no time. There seems to be a bug that prevents garbage collection from taking place, and as a result the proxy keeps asking for memory until it eventually crashes.

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.