View gist:b84ca52c9eb5d9d3b2b3d4cb5c0e39cb
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
const net = require("net"); | |
const server = net.createServer(); | |
// Listening to connection event | |
server.on("connection", (ClientToProxySocket) => { | |
console.log("Client connected to the proxy"); | |
ClientToProxySocket.once("data", (data) => { | |
//checking if connection is HTTP or HTTPS | |
let isTLSConnection = data.toString().indexOf("CONNECT") !== -1; |