Hi, 

How should I think (and do) to add numbers to each hop (line) on my 
traceroute.

Here is my script (it's example script from traceroute npm package)

traceroute = require('traceroute');
traceroute.trace('4.69.155.254', function (err,hops) {
  if (!err) console.log(hops);});


And output is like this

[ { '66.97.5.249': [ 43.206 ] },
  { '216.182.7.102': [ 43.575 ] },
  { '216.182.7.165': [ 44.538 ] },
  { '216.182.7.253': [ 44.846 ] },
  { '4.53.88.197': [ 57.735 ] },
  { '4.69.155.254': [ 58.618 ] } ]


I would like to change how data is showing, with adding an line number. 
like this.

[ { '1', '66.97.5.249': [ 43.206 ] },
  { '2', '216.182.7.102': [ 43.575 ] },
  { '3', '216.182.7.165': [ 44.538 ] },
  { '4', '216.182.7.253': [ 44.846 ] },
  { '5', '4.53.88.197': [ 57.735 ] },
  { '6', '4.69.155.254': [ 58.618 ] } ]

I think I need to calculate how many hops it is, and then do a for loop to 
add the number to each line?!


I'm also going to add this output data into a database. I don't know which 
database to use. I appreciate if someone can recommend some database I 
should use. MongoDB, Redis, Sqlite?


Regards,
Mattias  



-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to