Skip to content

Instantly share code, notes, and snippets.

@matejkramny
Created October 5, 2014 20:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matejkramny/81584068767594c4e741 to your computer and use it in GitHub Desktop.
Save matejkramny/81584068767594c4e741 to your computer and use it in GitHub Desktop.
Tiny net proxy
var net = require('net');
net.createServer(function (socket) {
socket.on('data', function (chunk) {
console.log(chunk.toString('utf8'));
});
var d = net.createConnection('/var/run/docker.sock');
d.on('data', function (chunk) {
console.log('res ->', chunk.toString('utf8'));
});
socket.pipe(d);
d.pipe(socket);
}).listen(3030);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment