From b5c1908b04bbc3d3b63346f7619debb247d44790 Mon Sep 17 00:00:00 2001 From: MrUnknownDE Date: Sat, 29 Mar 2025 11:35:01 +0100 Subject: [PATCH] add debug in traceroute endpoint --- backend/server.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/server.js b/backend/server.js index 55b0a1b..a9ffe59 100644 --- a/backend/server.js +++ b/backend/server.js @@ -254,7 +254,17 @@ app.get('/api/ping', async (req, res) => { app.get('/api/traceroute', async (req, res) => { const targetIp = req.query.targetIp; + // --- DEBUGGING START --- + console.log(`--- TRACEROUTE Request ---`); + console.log(`Raw req.query.targetIp:`, req.query.targetIp); + console.log(`Type of targetIp:`, typeof targetIp); + console.log(`Value of targetIp before validation: "${targetIp}"`); + // --- DEBUGGING END --- + if (!isValidIp(targetIp)) { + // --- DEBUGGING START --- + console.log(`isValidIp returned false for "${targetIp}"`); + // --- DEBUGGING END --- return res.status(400).json({ error: 'Invalid target IP address provided.' }); }