Coder Social home page Coder Social logo

nodejs-traceroute's Introduction

nodejs-traceroute Build Status Code Climate

NPM

Node.js wrapper around tracert and traceroute process

Install

npm install --save nodejs-traceroute

Force IPv4 or IPv6

By default, the domain name given will be automatically resolved. Explicitly force IPv4 or IPv6 tracerouting by passing either ipv4 or ipv6 to the constructor.

Usage Example

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

Result Example

pid: 4414
destination: 192.30.253.112
hop: {"hop":1,"ip":"192.168.0.1","rtt1":"1.817 ms"}
hop: {"hop":2,"ip":"10.233.33.58","rtt1":"3.149 ms"}
hop: {"hop":3,"ip":"10.55.96.182","rtt1":"7.820 ms"}
hop: {"hop":4,"ip":"128.241.1.205","rtt1":"178.187 ms"}
hop: {"hop":5,"ip":"129.250.2.9","rtt1":"211.609 ms"}
hop: {"hop":6,"ip":"129.250.3.43","rtt1":"229.458 ms"}
hop: {"hop":7,"ip":"129.250.2.163","rtt1":"237.948 ms"}
hop: {"hop":8,"ip":"129.250.2.138","rtt1":"237.913 ms"}
hop: {"hop":9,"ip":"129.250.2.133","rtt1":"241.748 ms"}
hop: {"hop":10,"ip":"*","rtt1":"*"}
hop: {"hop":11,"ip":"*","rtt1":"*"}
hop: {"hop":12,"ip":"*","rtt1":"*"}
hop: {"hop":13,"ip":"*","rtt1":"*"}
hop: {"hop":14,"ip":"*","rtt1":"*"}
hop: {"hop":15,"ip":"*","rtt1":"*"}
hop: {"hop":16,"ip":"*","rtt1":"*"}
hop: {"hop":17,"ip":"*","rtt1":"*"}
hop: {"hop":18,"ip":"*","rtt1":"*"}
hop: {"hop":19,"ip":"*","rtt1":"*"}
hop: {"hop":20,"ip":"*","rtt1":"*"}
hop: {"hop":21,"ip":"*","rtt1":"*"}
hop: {"hop":22,"ip":"*","rtt1":"*"}
hop: {"hop":23,"ip":"*","rtt1":"*"}
hop: {"hop":24,"ip":"*","rtt1":"*"}
hop: {"hop":25,"ip":"*","rtt1":"*"}
hop: {"hop":26,"ip":"*","rtt1":"*"}
hop: {"hop":27,"ip":"*","rtt1":"*"}
hop: {"hop":28,"ip":"*","rtt1":"*"}
hop: {"hop":29,"ip":"*","rtt1":"*"}
hop: {"hop":30,"ip":"*","rtt1":"*"}
close: code 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.