Internet Control Message Protocol in Node
npm install icmpNode wrapper for the ICMP protocol.
``sh`
npm install icmp
On Windows, Windows Build Tools are required: npm install -g windows-build-tools
or false, depending on the ping response$3
ICMP response type, will be one from this array:
`js
['REPLY', 'NA', 'NA', 'DESTINATION_UNREACHABLE', 'SOURCE_QUENCH', 'REDIRECT']
`
$3
ICMP response code, will be one from this array:
`js
['NET', 'HOST', 'PROTOCOL', 'PORT', 'FRAGMENTATION', 'ROUTE_FAILED', 'NET_UNKNOWN', 'HOST_UNKNOWN', 'HOST_ISOLATED', 'NET_PROHIBITED', 'HOST_PROHIBITED', 'NET_UNREACHABLE', 'HOST_UNREACHABLE', 'COMM_PROHIBITED', 'HOST_PRECEDENCE', 'PRECEDENCE_CUTOFF', 'NETWORK', 'HOST', 'SERVICE_NETWORK', 'HOST_NETWORK']
`
Methods
Note: default timeout of each methods is 5000ms.$3
Send a ping to a specific host. Returns a Promise resolving an ICMP instance and rejecting an Error.$3
Send a ping to the defined ICMP instance's host. Returns a Promise, resolving nothing and rejecting an Error.$3
Send data to a specific host through ICMP. Returns a Promise resolving an ICMP instance and rejecting an Error.`js
icmp.send('10.43.65.9', "Hey, I'm sending a message!")
.then(obj => {
console.log(obj.open ? 'Done' : 'Failed')
})
.catch(err => console.log(err));
``👤 Nathanael Demacon
* Twitter: @qtmsheep
* Github: @quantumsheep
Give a ⭐️ if this project helped you!