Created
October 13, 2019 21:18
-
-
Save penalosa/7935bb47b15e8c719f656a2932490676 to your computer and use it in GitHub Desktop.
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
var net = require("net"); | |
const tls = require("tls"); | |
var LOCAL_PORT = 7654; | |
var server = net.createServer(function(socket) { | |
const tlsSocket = tls.connect( | |
7878, | |
"localhost", | |
{ rejectUnauthorized: false }, | |
() => { | |
tlsSocket.on("data", function(data) { | |
socket.write(data); | |
}); | |
socket.on("data", function(msg) { | |
tlsSocket.write(msg); | |
}); | |
} | |
); | |
}); | |
server.listen(LOCAL_PORT); | |
console.log("TCP server accepting connection on port: " + LOCAL_PORT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment