Skip to content

AjayMT/tproxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tproxy

Super simple tcp proxy.

var net = require('net');
var proxy = require('tproxy');

net.createServer(function (sock) {
  sock.on('data', function () {
    sock.write('proxied');
  });
}).listen(3001);

net.createServer(function (sock) {
  proxy(sock, { port: 3001 });
}).listen(3000);

var s = net.connect({ port: 3000 }, function () {
  s.write('test');
});

s.on('data', function (data) {
  console.log(data.toString());
});

// will output 'proxied'

Installation

$ npm install tproxy --save

API

tproxy(sock, target)

Make a proxy between sock and target. This function returns an instance of net.Socket, which is the socket connected to target.

target is what you'd normally call net.connect with.

License

MIT License (see ./LICENSE).

About

super simple tcp proxy

Resources

License

Stars

Watchers

Forks

Packages

No packages published