diff --git a/package.json b/package.json index 2eb893c..4b1f6d0 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ }, "homepage": "https://github.com/fpv-wtf/margerine#readme", "dependencies": { - "@devicefarmer/adbkit": "2.11.3", "@sentry/node": "^6.18.1", "@sentry/tracing": "^6.18.1", "add": "^2.0.6", diff --git a/src/proxy.old.js b/src/proxy.old.js deleted file mode 100644 index 370ea50..0000000 --- a/src/proxy.old.js +++ /dev/null @@ -1,70 +0,0 @@ -const net = require('net'); - -const server = net.createServer(); - -server.on('connection', (clientToProxySocket) => { - console.log('Client Connected To Proxy'); - // We need only the data once, the starting packet - clientToProxySocket.once('data', (data) => { - // If you want to see the packet uncomment below - // console.log(data.toString()); - - let isTLSConnection = data.toString().indexOf('CONNECT') !== -1; - - // By Default port is 80 - let serverPort = 80; - let serverAddress; - if (isTLSConnection) { - // Port changed if connection is TLS - serverPort = data.toString() - .split('CONNECT ')[1].split(' ')[0].split(':')[1]; - serverAddress = data.toString() - .split('CONNECT ')[1].split(' ')[0].split(':')[0]; - } else { - serverAddress = data.toString().split('Host: ')[1].split('\r\n')[0]; - } - - console.log(serverAddress); - - let proxyToServerSocket = net.createConnection({ - host: serverAddress, - port: serverPort - }, () => { - console.log('PROXY TO SERVER SET UP'); - if (isTLSConnection) { - clientToProxySocket.write('HTTP/1.1 200 OK\r\n\n'); - } else { - proxyToServerSocket.write(data); - } - - clientToProxySocket.pipe(proxyToServerSocket); - proxyToServerSocket.pipe(clientToProxySocket); - - proxyToServerSocket.on('error', (err) => { - console.log('PROXY TO SERVER ERROR'); - console.log(err); - }); - - }); - clientToProxySocket.on('error', err => { - console.log('CLIENT TO PROXY ERROR'); - console.log(err); - }); - }); -}); - -server.on('error', (err) => { - console.log('SERVER ERROR'); - console.log(err); - throw err; -}); - -server.on('close', () => { - console.log('Client Disconnected'); -}); - -module.exports.listen = (port) => { - return server.listen(port, () => { - console.log('proxy server runnig at http://localhost:' + port); - }); -}