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

icmp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

icmp - npm Package Compare versions

Comparing version 1.3.2 to 1.4.0

example/listen.js

2

example/message.js

@@ -5,2 +5,2 @@ const icmp = require('icmp');

.then(obj => console.log(obj.open ? 'Done' : 'Failed'))
.catch(err => console.log(err));
.catch(err => console.log(err));

@@ -1,2 +0,2 @@

const icmp = require('../');
const icmp = require('icmp');
const readline = require('readline');

@@ -18,5 +18,5 @@

} catch (e) {
console.log(host, console.log(e));
console.log(host, 'Error');
}
}, 1000);
});
});

@@ -74,3 +74,3 @@ const raw = require('raw-socket');

this.diff = process.hrtime(this.start);
this.elapsed = (this.diff[0] + this.diff[1] / NS_PER_SEC) * 1000;
this.elapsed = (this.diff[0] + this.diff[1] / NS_PER_SEC) * 1000;

@@ -145,2 +145,11 @@ const offset = 20;

listen(cb = (buffer, source) => {}) {
return this.socket.on('message', cb);
}
static listen(cb = (buffer, source) => {}) {
const obj = new this(null);
return obj.listen(cb);
}
parse(type, code) {

@@ -147,0 +156,0 @@ const ECHOMessageType = ['REPLY', 'NA', 'NA', 'DESTINATION_UNREACHABLE', 'SOURCE_QUENCH', 'REDIRECT'];

{
"name": "icmp",
"version": "1.3.2",
"version": "1.4.0",
"description": "Internet Control Message Protocol in Node",

@@ -34,3 +34,3 @@ "main": "index.js",

"dependencies": {
"raw-socket": "^1.6.2"
"raw-socket": "^1.7.0"
},

@@ -37,0 +37,0 @@ "devDependencies": {

@@ -1,21 +0,20 @@

# Internet Control Message Protocol in Node
Internet Control Message Protocol implementation in Node (it has Promises).
<h1 align="center">Internet Control Message Protocol in Node</h1>
<p>
<img alt="Version" src="https://img.shields.io/npm/v/icmp.svg">
<a href="https://twitter.com/qtmsheep">
<img alt="Twitter: qtmsheep" src="https://img.shields.io/twitter/follow/qtmsheep.svg?style=social" target="_blank" />
</a>
</p>
# How to install
Install with npm: `npm install --save icmp`
> Internet Control Message Protocol in Node
# How to use
You can view examples in `example` directory.
# Install
### Little example for lazy peoples who don't want to open `exemple` directory
Here's how to find if a network card is receiving or not (basic ping) -->
```js
const icmp = require('icmp');
icmp.ping(ipv4)
.then(obj => console.log(obj.open))
.catch(err => { });
```sh
npm install icmp
```
# Usage:
On Windows, the Windows Build Tools are required: `npm install -g windows-build-tools`
# Usage
## Properties

@@ -66,6 +65,20 @@ ### ICMP.host: string

### (static) ICMP.listen(cb: (buffer, source) => void)
Listen to incomming ICMP requests.
### ICMP.listen(cb: (buffer, source) => void)
Listen to incomming ICMP requests.
### ICMP.close()
Close the raw socket stream. Can be used to stop a request.
## License
MIT
# Author
👤 **Nathanael Demacon**
* Twitter: [@qtmsheep](https://twitter.com/qtmsheep)
* Github: [@quantumsheep](https://github.com/quantumsheep)
# Show your support
Give a ⭐️ if this project helped you!
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