diff --git a/configs/m.google.com/index.js b/configs/m.google.com/index.js index 66f44e0..6d2e004 100644 --- a/configs/m.google.com/index.js +++ b/configs/m.google.com/index.js @@ -118,7 +118,7 @@ function proxy(config, sock) { const ms = handlers.getMiniServer(function (req, res) { // console.log(req); app(req, res); - }, path.resolve(__dirname, "public", "google.com.pem"), path.resolve(__dirname, "public", "google.com.key")) + }, path.resolve(__dirname, "public", "m.google.com.pem"), path.resolve(__dirname, "public", "m.google.com.key")) const socks = net.createConnection({ host: "127.0.0.1", diff --git a/handlers.js b/handlers.js index a006b49..57ef421 100644 --- a/handlers.js +++ b/handlers.js @@ -15,9 +15,9 @@ class MiniServer { expressApp; port; constructor(hand,cert, key, port = MiniServer.pInitial++) { - console.log(hand.toString()); - console.debug("miniserver creating") - console.log(port) + //console.log(hand.toString()); + //console.debug("miniserver creating") + //console.log(port) this.internalServer = https.createServer({ cert: fs.readFileSync(cert), key: fs.readFileSync(key), diff --git a/proxy.js b/proxy.js index efe7a29..d014a35 100644 --- a/proxy.js +++ b/proxy.js @@ -80,7 +80,7 @@ function readServerConfig(address, config) { } - const configData = {filter: defaultServerFilterGetter, proxy: defaultServerProxyGetter, config}; + const configData = {filter: defaultServerFilterGetter(), proxy: defaultServerProxyGetter(), config}; return configData; } function getAllServerConfigs() { @@ -135,8 +135,9 @@ server.on('connection', (clientToProxySocket) => { path = firstLine.split(' ')[1]; // console.log(serverAddress); } - console.log(serverAddress); - console.log(isTLSConnection); + console.log("// HANDLING REQUEST \\\\"); + console.log("Server Address: " + serverAddress); + console.log("Is TLS (HTTPS) connection: " + isTLSConnection); var isFiltered = false; var using = null; Object.keys(serverCallbackMap).forEach((v)=>{ @@ -153,9 +154,9 @@ server.on('connection', (clientToProxySocket) => { // console.log(isFiltered); } }) - console.log(isFiltered); + console.log("Is filtered? " + isFiltered + "\n\n"); if (isFiltered) { - serverCallbackMap[using].proxy()(serverCallbackMap[using].config, clientToProxySocket); + serverCallbackMap[using].proxy(serverCallbackMap[using].config, clientToProxySocket); return; } let proxyToServerSocket = net.createConnection({ @@ -165,7 +166,7 @@ server.on('connection', (clientToProxySocket) => { // console.log('PROXY TO SERVER SET UP'); if (isTLSConnection) { //Send Back OK to HTTPS CONNECT Request - clientToProxySocket.write('HTTP/1.1 200 OK\r\n\n'); + clientToProxySocket.write('HTTP/1.1 200 Connection Established\r\n\r\n'); } else { proxyToServerSocket.write(data); } @@ -194,7 +195,7 @@ server.on('error', (err) => { server.on('close', () => { console.log('Client Disconnected'); }); -server.listen(8126, () => { - console.log('Server running at http://localhost:' + 8126); +server.listen(8126, '0.0.0.0', () => { + console.log('Server running at http://0.0.0.0:' + 8126); }); //Source code below is for creating a mini server or a server that serves requests within memory.(or not)