Last active
December 17, 2015 01:10
-
-
Save marcelog/5526738 to your computer and use it in GitHub Desktop.
Quick and small tcp proxy written in nodejs. Opens a socket and listens for incoming connections. For every new incoming connection, it will open a connection to the proxied host, and send whatever it gets from either side to the other.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var port_to = 6379; | |
var port_from = 63790; | |
var net = require('net'); | |
var server = net.createServer(function(clientSocket) { | |
var targetSocket = net.connect({port: port_to}); | |
targetSocket.on('data', function(data) { | |
clientSocket.write(data); | |
}); | |
clientSocket.on('data', function(data) { | |
targetSocket.write(data); | |
}) | |
}); | |
server.listen(port_from); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment