From: charleswrayjr Date: Mon, 8 Sep 2025 15:59:00 +0000 (-0500) Subject: Testing vpn paths. X-Git-Url: https://git.phasecustomsoft.com/static/css/main.5249b75a.css?a=commitdiff_plain;h=6f8e6983e8661d66ba70b7951aba2802803dd077;p=phs-api.git Testing vpn paths. --- diff --git a/src/controllers/vpn.controller.js b/src/controllers/vpn.controller.js index dad32dd..60115d0 100644 --- a/src/controllers/vpn.controller.js +++ b/src/controllers/vpn.controller.js @@ -87,17 +87,15 @@ module.exports = { stream.on( 'close', ( code ) => { conn.end(); if (code === 0) { - 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 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, mIndex ).map( line => { + const clients = C.slice( sIndex + 1, mIndex ).map( line => { const parts = line.split( ',' ); - const vLine = lines.find( l => l.includes( parts[0] ) && l !== line ); + const vLine = R.find( l => l.includes( parts[0] ) && l !== line ); return { name:parts[0], ip:parts[1], virtual_ip:vLine.split( ',' )[0], connectedSince:parts[4] }; } ); res.json( { clients } );