nodejs-traceroute icon indicating copy to clipboard operation
nodejs-traceroute copied to clipboard

How to stop the traceroute task?

Open liaodalin19903 opened this issue 1 year ago • 0 comments

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);
}

liaodalin19903 avatar Aug 10 '23 04:08 liaodalin19903