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

index d2ddf8e016b7f982b150ece21cfd06ac0b712396..dad32ddd2ffa9d1576433f83f8d182448abcba97 100644 (file)
@@ -90,11 +90,12 @@ module.exports = {
             console.log(output);
             const lines = output.split( '\n' );
             const sIndex = lines.findIndex( line => line.startsWith( 'Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since' ) );
-            const eIndex = lines.findIndex( line => line.startsWith( 'ROUTING TABLE' ) );
-            const C = [...lines].slice(sIndex +1, eIndex).filter( line => line.trim() );
-            const R = [...lines].slice(eIndex +2, lines.length).filter( line => line.trim() );
+            const mIndex = lines.findIndex( line => line.startsWith( 'ROUTING TABLE' ) );
+            const eIndex = lines.findIndex( line => line.startsWith( 'GLOBAL STATS' ) );
+            const C = [...lines].slice(sIndex +1, mIndex).filter( line => line.trim() );
+            const R = [...lines].slice(mIndex +2, eIndex).filter( line => line.trim() );
             console.log('clients: ', C, ' routes: ', R );
-            const clients = lines.slice( sIndex + 1, eIndex ).map( line => {
+            const clients = lines.slice( sIndex + 1, mIndex ).map( line => {
               const parts = line.split( ',' );
               const vLine = lines.find( l => l.includes( parts[0] ) && l !== line );
               return { name:parts[0], ip:parts[1], virtual_ip:vLine.split( ',' )[0], connectedSince:parts[4] };