diff --git a/server/lambda/check-ports.js b/server/lambda/check-ports.js index 2b0538d..63df738 100644 --- a/server/lambda/check-ports.js +++ b/server/lambda/check-ports.js @@ -6,27 +6,21 @@ const PORTS = [21, 22, 25, 80, 110, 143, 443, 587, 993, 995, 3306, 3389, 5900, 8 async function checkPort(port, domain) { return new Promise(resolve => { const socket = new net.Socket(); - console.log(port, 'Init'); socket.setTimeout(1500); // you may want to adjust the timeout socket.once('connect', () => { - console.log(port, 'Connected!'); socket.destroy(); resolve(port); }); socket.once('timeout', () => { - console.log(port, 'Timedout'); socket.destroy(); }); socket.once('error', (e) => { - console.log(port, 'Errored', e); socket.destroy(); }); - - console.log(port, 'End'); socket.connect(port, domain); }); } diff --git a/server/lambda/trace-route.js b/server/lambda/trace-route.js index caf143a..c90fc13 100644 --- a/server/lambda/trace-route.js +++ b/server/lambda/trace-route.js @@ -7,6 +7,7 @@ const traceroutePromise = util.promisify(traceroute.trace); exports.handler = async function(event, context) { const urlString = event.queryStringParameters.url; + const startTime = Date.now(); try { if (!urlString) { @@ -22,9 +23,10 @@ exports.handler = async function(event, context) { } const result = await traceroutePromise(host); + const timeTaken = Date.now() - startTime; return { statusCode: 200, - body: JSON.stringify({ message: "Traceroute completed!", result }), + body: JSON.stringify({ message: "Traceroute completed!", result, timeTaken }), }; } catch (err) { return {