nodejs-traceroute
nodejs-traceroute copied to clipboard
How to stop the traceroute task?
How to stop the traceroute task?
In the usage example, how to stop the traceroute task?
const Traceroute = require('nodejs-traceroute');
try {
const tracer = new Traceroute();
tracer
.on('pid', (pid) => {
console.log(`pid: ${pid}`);
})
.on('destination', (destination) => {
console.log(`destination: ${destination}`);
})
.on('hop', (hop) => {
console.log(`hop: ${JSON.stringify(hop)}`);
})
.on('close', (code) => {
console.log(`close: code ${code}`);
});
tracer.trace('github.com');
} catch (ex) {
console.log(ex);
}