add debug in traceroute endpoint

This commit is contained in:
2025-03-29 11:35:01 +01:00
parent 0e52a0cd06
commit b5c1908b04

View File

@@ -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.' });
}