A Mutable Log

A blog by Devendra Tewari


Project maintained by tewarid Hosted on GitHub Pages — Theme by mattgraham

A simple TCP proxy in Node.js

A TCP proxy built with Node.js, that may be used to access a service on another network, is available at GitHub.

It is an extensible replacement for socat when used thus

socat TCP-LISTEN:port1,fork TCP:host:port2

To achieve the same with node-tcp-proxy

tcpproxy  --proxyPort [port1] --serviceHost [host] --servicePort [port2]

To install node-tcp-proxy using npm

sudo npm install -g node-tcp-proxy

To create a proxy in your own code

var proxy = require("node-tcp-proxy");
var newProxy = proxy.createProxy(8080, "hostname", 10080);

To end the proxy

newProxy.end();