You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for my application I wanted to use mtr instead of regular traceroute, I'm including the code I used below in case it's useful to you:
"use strict";varspawn=require('child_process').spawn;functiontrace(host,opts,cb){if(!opts.cycles){opts.cycles=3;}varmtr=spawn('mtr',['--raw','--report-cycles',opts.cycles,host]);mtr.stderr.on('data',function(data){console.error("ERROR: "+data);});mtr.stdout.on('data',function(data){varlines=data.toString().split('\n');console.log("lines",lines);for(vari=0;i<lines.length;i++){if(lines[i]===''){break;}varr=lines[i].split(' ');r[1]=parseInt(r[1],10);if(r[0]==='p'){r[2]=parseInt(r[2],10);}cb(null,r);}});mtr.on('exit',function(code){console.log("mtr done!");cb(null,["x",code]);if(code!==0){console.error('mtr process exited with code '+code);}});}exports.trace_raw=function(host,opts,cb){if(typeofopts==='function'){cb=opts;opts={};}trace(host,opts,cb);};
@abh Not sure if you're still interested or not, but I finally did as you suggested :) Latest code in master has it, but I've yet to publish version 2.0.0 to NPM
It'd be nice if there was an option to get each hop as traceroute finds them, rather than just a result when it's all done.
The text was updated successfully, but these errors were encountered: