Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ping-metrics

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ping-metrics - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

16

example.js

@@ -5,3 +5,3 @@ // Example usage. Run with `node example.js`

pingMetrics({ip: "104.160.131.1", interval: 1000}, function(metrics) {
var ping1 = pingMetrics({ip: "104.160.131.1", interval: 1000}, function(metrics) {
console.log([

@@ -14,4 +14,5 @@ "NA Ping: " + Math.round(metrics.ping),

});
ping1.run();
pingMetrics({ip: "185.40.65.1", interval: 3000}, function(metrics) {
var ping2 = pingMetrics({ip: "185.40.65.1", interval: 3000}, function(metrics) {
console.log([

@@ -24,1 +25,12 @@ "EUW Ping: " + Math.round(metrics.ping),

});
ping2.run();
setTimeout(function() {
console.log("Stopping ping1");
ping1.stop();
}, 5500);
setTimeout(function() {
console.log("Resuming ping1");
ping1.run();
}, 10500);

@@ -51,4 +51,8 @@ var ping = require('net-ping');

var pingValues = [];
var stop = false;
var run = function() {
if (stop) {
return;
}
var timeStart = new Date().getTime();

@@ -82,5 +86,13 @@ session.pingHost(options.ip, function(err, target, sent, rcvd) {

};
run();
return {
run: function() {
stop = false;
run();
},
stop: function() {
stop = true;
}
};
};
module.exports = pingMetrics;

2

package.json
{
"name": "ping-metrics",
"version": "1.0.0",
"version": "1.0.1",
"description": "Ping (ICMP) rolling metrics",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,3 +18,3 @@ # ping-metrics

};
pingMetrics(options, function(metrics) {
var ping = pingMetrics(options, function(metrics) {
console.log([

@@ -27,2 +27,7 @@ "Current Ping: " + metrics.ping,

});
ping.run();
// You can also stop and resume:
ping.stop();
ping.run();
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc