Permalink
Browse files

examples and a readme

  • Loading branch information...
1 parent d82e500 commit 8443b925e6b6002494368880de7872b35ce1cf38 @substack substack committed Dec 14, 2010
Showing with 44 additions and 0 deletions.
  1. +32 −0 README.markdown
  2. +8 −0 examples/client.js
  3. +4 −0 examples/server.js
View
@@ -0,0 +1,32 @@
+prox
+====
+
+Network proxy server and client module.
+
+Examples
+========
+
+server.js
+---------
+ var socks5 = require('prox').socks5;
+ socks5.createServer(function (err, req, stream) {
+ stream.write('Requested ' + req.host + ':' + req.port);
+ }).listen(7890)
+
+client.js
+---------
+ var socks5 = require('prox').socks5;
+
+ var stream = socks5.createConnection('localhost', 7890)
+ .connect('substack.net', 1337);
+
+ stream.on('data', function (buf) {
+ console.log(buf.toString());
+ });
+
+output
+------
+ $ node server.js &
+ [1] 32058
+ $ node client.js
+ Requested substack.net:1337
View
@@ -0,0 +1,8 @@
+var socks5 = require('prox').socks5;
+
+var stream = socks5.createConnection('localhost', 7890)
+ .connect('substack.net', 1337);
+
+stream.on('data', function (buf) {
+ console.log(buf.toString());
+});
View
@@ -0,0 +1,4 @@
+var socks5 = require('prox').socks5;
+socks5.createServer(function (err, req, stream) {
+ stream.write('Requested ' + req.host + ':' + req.port);
+}).listen(7890)

0 comments on commit 8443b92

Please sign in to comment.