From 886a8707078f59d0467b34686455bb5bdfadbc0c Mon Sep 17 00:00:00 2001 From: yawnt Date: Sat, 14 Sep 2013 18:44:39 +0200 Subject: [PATCH] [docs] readme --- .gitignore | 2 +- README.md | 46 +++++++++++++++++++++++++++++++++++++ ttest.js | 67 ------------------------------------------------------ 3 files changed, 47 insertions(+), 68 deletions(-) create mode 100644 README.md delete mode 100644 ttest.js diff --git a/.gitignore b/.gitignore index 517f9ce..d1ae715 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ node_modules *.swp cov -!ttest.js +atest.js notes diff --git a/README.md b/README.md new file mode 100644 index 0000000..cf7e59a --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +Caronte +======= + +Caronte is an HTTP programmable proxying library that supports +websockets. It is suitable for implementing components such as +proxies and load balancers. + +### Contributing and Issues + +* Search on Google/Github +* If you can't find anything, open an issue +* If you feel comfortable about fixing the issue, fork the repo +* Commit to your local branch (which must be different from `master`) +* Submit your Pull Request (be sure to include tests and update documentation) + +### Test + +``` +$ npm test +``` + +### License + +``` +The MIT License (MIT) + +Copyright (c) 2013 Nodejitsu Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +``` diff --git a/ttest.js b/ttest.js deleted file mode 100644 index 3f945e4..0000000 --- a/ttest.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; /* jshint node:true */ -var caronte = require('./'), - http = require('http'), - ws = require('ws'); - -/*var proxyTo = new ws.Server({ port: 9090 }); - -proxyTo.on('connection', function(ws) { - console.log('connection!'); - ws.on('message', function(msg) { - ws.send('ohai: ' + msg); - setTimeout(function() { - ws.send('HAHAHHA'); - }, 10000); - }); - ws.send('derpity?'); -}); - -var client = new ws('ws://127.0.0.1:8000'); -client.on('open', function() { - client.send('baaaka'); - console.log('sent: baaaaka'); - setTimeout(function() { - client.send('cacca'); - }, 5000); - client.on('message', function(msg) { - console.log('server said: ' + msg); - }); -}); -*/ - - -caronte.createProxyServer({ - ws : true, - forward: 'http://127.0.0.1:9090' -}).listen(8080); - - - -var srv = http.createServer(function(req, res) { - res.end('ciao proxy'); - console.log('suca'); -}).listen(9090); -/* -srv.on('upgrade', function(req, sock, head) { - - var options = { - port: 9090, - hostname: '127.0.0.1', - headers: req.headers - } - var r = http.request(options); - - r.on('upgrade', function(res, proxySock, hd) { - if (hd && hd.length) proxySock.unshift(hd); - - sock.write('HTTP/1.1 101 Switching Protocols\r\n'); - sock.write(Object.keys(res.headers).map(function(i) { - return i + ": " + res.headers[i]; - }).join('\r\n') + '\r\n\r\n'); - proxySock.pipe(sock).pipe(proxySock); - }); - - r.end(); -}); - -*/