From 9c528e10198d1813cdfb1f6fbe95c59511b5f13c Mon Sep 17 00:00:00 2001 From: charleswrayjr Date: Mon, 8 Sep 2025 11:12:31 -0500 Subject: [PATCH] Testing vpn paths. --- src/controllers/vpn.controller.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/controllers/vpn.controller.js b/src/controllers/vpn.controller.js index 642126a..ebac448 100644 --- a/src/controllers/vpn.controller.js +++ b/src/controllers/vpn.controller.js @@ -88,7 +88,9 @@ module.exports = { conn.end(); if (code === 0) { // Split once and reuse - const lines = output.split('\n').map(line => line.trim()).filter(Boolean); + const lines = output.split('\n').map(line => line.trim()); + + console.log('lines: ', lines); // Find indices using a single pass let sIndex = -1, mIndex = -1, eIndex = -1; @@ -98,6 +100,8 @@ module.exports = { else if (eIndex === -1 && line.startsWith('GLOBAL STATS')) eIndex = i; }); + console.log('indexes: ', sIndex, mIndex, eIndex); + // Early return if indices not found if (sIndex === -1 || mIndex === -1 || eIndex === -1) return []; @@ -113,6 +117,8 @@ module.exports = { }); } + console.log('clientsMap: ', clientsMap); + // Assign virtual IPs for (let i = mIndex + 2; i < eIndex; i++) { const parts = lines[i].split(','); @@ -120,6 +126,8 @@ module.exports = { if (client) client.virtual_ip = parts[0]; } + console.log('clientsMap: ', clientsMap); + res.json(clientsMap.values()); /*const lines = output.split( '\n' ); const sIndex = lines.findIndex( line => line.startsWith( 'Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since' ) ); -- 2.43.0