Update, insert new ping method

Took 29 minutes
This commit is contained in:
2021-08-27 08:30:39 +02:00
parent ecb804fe4c
commit cf29acee58
143 changed files with 14731 additions and 2 deletions

9
node_modules/get-ip-range/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,9 @@
## v2.1.1
- Fix error message
## v2.1.0
- Remove debugger
## v2.0.0
- IPv6 Support
- Hyphenated range support

7
node_modules/get-ip-range/LICENSE generated vendored Normal file
View File

@ -0,0 +1,7 @@
ISC License
Copyright (c) 2017 Joe Schofield
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

79
node_modules/get-ip-range/README.md generated vendored Normal file
View File

@ -0,0 +1,79 @@
# get-ip-range
Simple utility to convert either CIDR notation, a hyphenated IP range, or two IP addresses to an array of the range of IP addresses.
----
<a href="https://nodei.co/npm/get-ip-range/"><img src="https://nodei.co/npm/get-ip-range.png?downloads=true"></a>
![Build Status](https://travis-ci.org/JoeScho/get-ip-range.svg?branch=master)[![Coverage Status](https://coveralls.io/repos/github/JoeScho/getIPRange/badge.svg?branch=master)](https://coveralls.io/github/JoeScho/getIPRange?branch=master)[![ISC License](https://img.shields.io/badge/license-ISC-blue.svg?style=flat-square)](https://github.com/JoeScho/getIPRange/blob/master/LICENSE)
----
## Installation
```sh
$ npm i get-ip-range
```
----
## Accepted formats
### IPv4
* CIDR `"x.x.x.x/x"`
* Range `"x.x.x.x-x.x.x.x"`
* Two IPs `"x.x.x.x, x.x.x.x"`
### IPv6
* CIDR `"x:x:x:x:x:x:x:x/x"`
* Range `"::x:x:x-::x:x:x"`
* Two IPs `"::x:x:x", "::x:x:x"`
**N.B. Shorthand IPv6 is supported**
----
## Usage
```js
const getIPRange = require('get-ip-range');
const ipv4CIDR = getIPRange('192.168.1.134/29');
const ipv4Range = getIPRange('192.168.1.128-192.168.1.135');
const twoIPv4 = getIPRange('192.168.1.128', '192.168.1.135');
// All return:
//
// [
// '192.168.1.128',
// '192.168.1.129',
// '192.168.1.130',
// '192.168.1.131',
// '192.168.1.132',
// '192.168.1.133',
// '192.168.1.134',
// '192.168.1.135',
// ]
//
const ipv6CIDR = getIPRange('0:0:0:0:0:ffff:102:304/126');
const ipv6Range = getIPRange('::ffff:102:304-::ffff:102:307');
const twoIPv6 = getIPRange('::ffff:102:304', '::ffff:102:307');
// All return:
//
// [
// '::ffff:102:304',
// '::ffff:102:305',
// '::ffff:102:306',
// '::ffff:102:307',
// ]
//
```
----
**Errors**
If the supplied IP address(es) are invalid, the request will **throw an [error](https://nodejs.org/api/errors.html#errors_class_error)**. Please handle errors appropriately.
----

79
node_modules/get-ip-range/index.js generated vendored Normal file
View File

@ -0,0 +1,79 @@
const ip = require('ip');
const ipAddress = require('ip-address')
const { cidrv4, cidrv6 } = require('cidr-regex');
const errorMessage = new Error('IP supplied is not valid');
const getRangev4 = (ip1, ip2) => {
const ips = [];
let firstAddressLong = ip.toLong(ip1);
const lastAddressLong = ip.toLong(ip2);
for (firstAddressLong; firstAddressLong <= lastAddressLong; firstAddressLong++)
ips.push(ip.fromLong(firstAddressLong));
return ips;
}
const getRangev6 = (ip1, ip2) => {
const ips = [];
const firstAddress = new ipAddress.Address6(ip1);
const lastAddress = new ipAddress.Address6(ip2);
for (let i = firstAddress.bigInteger(); i <= lastAddress.bigInteger(); i++) {
ips.push(ipAddress.Address6.fromBigInteger(i).correctForm());
}
return ips;
}
const isCIDR = ip => {
return ip.indexOf('/') !== -1
}
const isRange = ip => {
return ip.indexOf('-') !== -1
}
const convert = (cidrIp, ip2) => {
const ip1v4 = new ipAddress.Address4(cidrIp);
const ip1v6 = new ipAddress.Address6(cidrIp);
if (ip2) {
const ip2v4 = new ipAddress.Address4(ip2);
const ip2v6 = new ipAddress.Address6(ip2);
if (ip1v4.valid && ip2v4.valid && !isCIDR(cidrIp) && !isCIDR(ip2)) {
return getRangev4(cidrIp, ip2);
}
if (ip1v6.valid && ip2v6.valid) {
return getRangev6(cidrIp, ip2);
}
} else {
if (ip1v4.valid) {
const subnet = ip.cidrSubnet(cidrIp);
const firstAddress = subnet.firstAddress;
const lastAddress = subnet.lastAddress;
return getRangev4(firstAddress, lastAddress);
}
if (ip1v6.valid) {
const IPv6 = new ipAddress.Address6(cidrIp);
return getRangev6(IPv6.startAddress().correctForm(), IPv6.endAddress().correctForm());
}
if (isRange(cidrIp)) {
const [ firstAddress, lastAddress ] = cidrIp.split('-');
return convert(firstAddress, lastAddress);
}
}
throw errorMessage;
}
module.exports = convert;

69
node_modules/get-ip-range/package.json generated vendored Normal file
View File

@ -0,0 +1,69 @@
{
"name": "get-ip-range",
"version": "2.1.1",
"description": "Simple utility to convert either CIDR notation or two IP addresses to an array of the range of IP addresses",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "nyc --reporter=html --reporter=text mocha *.test.js",
"jshint": "jshint *.js *.test.js",
"code-style": "jscs -p airbnb --fix *.js *.test.js",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"check-coverage": "nyc check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
"open-coverage": "open coverage/index.html"
},
"files": [
"LICENSE",
"README.md",
"index.js"
],
"keywords": [
"CIDR",
"IP"
],
"author": "@JoeScho <joeschofield@live.co.uk>",
"license": "ISC",
"bugs": {
"url": "https://github.com/JoeScho/get-ip-range/issues"
},
"homepage": "https://github.com/JoeScho/get-ip-range#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/JoeScho/get-ip-range.git"
},
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.2",
"jscs": "^3.0.7",
"jshint": "^2.10.1",
"mocha": "^5.2.0",
"nyc": "^14.1.1"
},
"pre-commit": [
"jshint",
"code-style",
"test",
"check-coverage"
],
"jshintConfig": {
"boss": true,
"node": true,
"strict": false,
"smarttabs": true,
"maxlen": 100,
"newcap": false,
"undef": true,
"unused": true,
"onecase": true,
"indent": 2,
"sub": true,
"esversion": 8
},
"dependencies": {
"cidr-regex": "^1.0.7",
"ip": "^1.1.5",
"ip-address": "^6.1.0"
}
}