]> PHS Git Server - phs-api.git/commitdiff
Testing vpn paths.
authorcharleswrayjr <charleswrayjr@gmail.com>
Mon, 8 Sep 2025 16:12:31 +0000 (11:12 -0500)
committercharleswrayjr <charleswrayjr@gmail.com>
Mon, 8 Sep 2025 16:12:31 +0000 (11:12 -0500)
src/controllers/vpn.controller.js

index 642126a2adde6c18e748ef8ee9eb7f95fba95074..ebac4484ee93a6f4b57170ff11b973e008115f04 100644 (file)
@@ -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' ) );