{"name":"bouncy","description":"route incoming http requests to http servers","version":"2.0.3","repository":{"type":"git","url":"git://github.com/substack/bouncy.git"},"main":"index.js","bin":{"bouncy":"bin/bouncy.js"},"keywords":["http","proxy","router","load","balancer"],"scripts":{"test":"tap test/*.js"},"dependencies":{"http-raw":"~1.1.0"},"devDependencies":{"tap":"~0.3.3","lazy":"1.0.x","websocket-server":"~1.4.04","wsclient":"~0.2.0","chunky":"~0.0.0"},"license":"MIT","author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"_id":"bouncy@2.0.3","dist":{"shasum":"a3f2c9b73bd3adaaad3f98966de871eefa937fe6","tarball":"http://registry-npm.ywwl.com/bouncy/download/bouncy-2.0.3.tgz","integrity":"sha512-lMq2PO4MhcdHzrRCcgWvRNjDEhxKj0Ufdoe08Urw9PD3eajykG3UraCq7jcAFroEKBgGtWx8lH6iLEiRUWWEXA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7cGU3l8FJQk+fUias+aNmrL4tuqm0gsGBXyWwZnnM7AIgN7JTg3Ud9emmbYb3CgB7twESqeFjHySWw4pgpLc9ipE="}],"size":16250,"noattachment":false,"key":"/bouncy/-/bouncy-2.0.3.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"directories":{},"readme":"# bouncy\n\npipe raw http traffic from incoming http requests to remote endpoints\n\n[![build status](https://secure.travis-ci.org/substack/bouncy.png)](http://travis-ci.org/substack/bouncy)\n\n![trampoline](http://substack.net/images/trampoline.png)\n\n# example\n\n## route.js\n\nRoute requests based on the host field to servers on ports 8001 and 8002:\n\n``` js\nvar bouncy = require('bouncy');\n\nvar server = bouncy(function (req, res, bounce) {\n    if (req.headers.host === 'beep.example.com') {\n        bounce(8001);\n    }\n    else if (req.headers.host === 'boop.example.com') {\n        bounce(8002);\n    }\n    else {\n        res.statusCode = 404;\n        res.end('no such host');\n    }\n});\nserver.listen(8000);\n```\n\n# var server = bouncy(opts={}, cb)\n\n`bouncy(cb)` returns a new net.Server object that you can `.listen()` on.\n\nIf you specify `opts.key` and `opts.cert`, the connection will be set to secure\nmode using tls. Do this if you want to make an https router.\n\nIf the arity of `cb` is 3, you'll get the response object `res` in\n`cb(req, res, bounce)`.\nOtherwise you just get `cb(req, bounce)`.\n\nIf you are using more than one SSL cert, add `opts.SNICallback`.\nSee the example http-https-sni.js and the\n[nodejs tls page](http://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener)\nfor details.\n\n## bounce(stream, opts={})\n\nCall this function when you're ready to bounce the request to a stream.\n\nThe exact request that was received will be written to `stream` and future\nincoming data will be piped to and from it.\n\nTo send data to a different url path on the destination stream, you can specify\n`opts.path`.\n\nTo change the http verb you can set `opts.method`.\n\nYou can specify header fields to insert into the request with `opts.headers`.\n\n`bounce()` returns the stream object that it uses to connect to the remote host.\n\n## bounce(port, ...), bounce(host, port, ...), bounce(url)\n\nThese variants of `bounce()` are sugar for\n`bounce(net.connect(port))` and `bounce(net.connect(port, host))`.\n\nOptionally you can pass port and host keys to `opts` and it does the same thing.\n\nPassing `bounce()` a string that looks like a url (with or without `\"http://\"`)\nwill set the opts.host, opts.port, and opts.path accordingly.\n\n# usage\n\n```\nusage: bouncy FILE PORT\n\nCreate a routes FILE like this:\n\n  {\n    \"beep.example.com\" : 8000,\n    \"boop.example.com\" : 8001\n  }\n\nThen point the `bouncy` command at this `routes.json` file and give it\na port to listen on: \n\n  bouncy routes.json 80\n\nThe `routes.json` file should just map host names to host/port combos. Use a\ncolon-separated string to specify a host and port in a route.\n\nUse `\"\"` for the host as a default route.\n\nYou can optionally specify a listen address as the third parameter or with\n`--address`. It defaults to `0.0.0.0`. Specify `::` to listen on both IPv4 and\nIPv6 addresses.\n```\n\n# install\n\nWith [npm](http://npmjs.org), to get the library do:\n\n```\nnpm install bouncy\n```\n\nor to install the command-line tool do:\n\n```\nnpm install -g bouncy\n```\n\n# license\n\nMIT\n","publish_time":1355892496396,"_cnpm_publish_time":1355892496396,"dist-tags":{"latest":"3.2.2"}}