nodejs-traceroute
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -5,18 +5,21 @@ 'use strict'; | ||
const tracer = new 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 | ||
.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'); | ||
tracer.trace('github.com'); | ||
} catch (ex) { | ||
console.log(ex); | ||
} |
{ | ||
"name": "nodejs-traceroute", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Node.js wrapper around tracert and traceroute process", | ||
@@ -19,3 +19,6 @@ "main": "index.js", | ||
"traceroute" | ||
] | ||
], | ||
"dependencies": { | ||
"validator": "^5.5.0" | ||
} | ||
} |
@@ -6,2 +6,3 @@ 'use strict'; | ||
const readline = require('readline'); | ||
const validator = require('validator'); | ||
@@ -17,2 +18,6 @@ class Process extends events.EventEmitter { | ||
trace(domainName) { | ||
if (!this.isValidDomainName(domainName)) { | ||
throw "Invalid domain name or IP address"; | ||
} | ||
this.args.push(domainName); | ||
@@ -51,2 +56,6 @@ | ||
isValidDomainName(domainName) { | ||
return validator.isFQDN(domainName + '') || validator.isIP(domainName + ''); | ||
} | ||
parseDestination(data) {} | ||
@@ -53,0 +62,0 @@ parseHop(hopData) {} |
@@ -13,19 +13,22 @@ # nodejs-traceroute | ||
const tracer = new 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 | ||
.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'); | ||
tracer.trace('github.com'); | ||
} catch (ex) { | ||
console.log(ex); | ||
} | ||
``` | ||
@@ -32,0 +35,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8951
146
70
1
+ Addedvalidator@^5.5.0
+ Addedvalidator@5.7.0(transitive)