diff options
-rw-r--r-- | node_modules/is-cidr/.npmignore | 1 | ||||
-rw-r--r-- | node_modules/is-cidr/.travis.yml | 21 | ||||
-rw-r--r-- | node_modules/is-cidr/README.md | 58 | ||||
-rw-r--r-- | node_modules/is-cidr/example/example.js | 14 | ||||
-rw-r--r-- | node_modules/is-cidr/lib/index.js | 18 | ||||
-rw-r--r-- | node_modules/is-cidr/node_modules/cidr-regex/.npmignore | 1 | ||||
-rw-r--r-- | node_modules/is-cidr/node_modules/cidr-regex/README.md | 49 | ||||
-rw-r--r-- | node_modules/is-cidr/node_modules/cidr-regex/lib/index.js | 10 | ||||
-rw-r--r-- | node_modules/is-cidr/node_modules/cidr-regex/package.json | 68 | ||||
-rw-r--r-- | node_modules/is-cidr/node_modules/cidr-regex/test.js | 200 | ||||
-rw-r--r-- | node_modules/is-cidr/package.json | 94 | ||||
-rw-r--r-- | node_modules/is-cidr/test/index.test.js | 200 | ||||
-rw-r--r-- | package-lock.json | 15 | ||||
-rw-r--r-- | package.json | 2 |
14 files changed, 751 insertions, 0 deletions
diff --git a/node_modules/is-cidr/.npmignore b/node_modules/is-cidr/.npmignore new file mode 100644 index 000000000..8eba6c8dd --- /dev/null +++ b/node_modules/is-cidr/.npmignore @@ -0,0 +1 @@ +src/ diff --git a/node_modules/is-cidr/.travis.yml b/node_modules/is-cidr/.travis.yml new file mode 100644 index 000000000..6eeec8aa9 --- /dev/null +++ b/node_modules/is-cidr/.travis.yml @@ -0,0 +1,21 @@ +sudo: false +language: node_js +cache: + directories: + - node_modules +notifications: + email: false +node_js: + - '4' +before_install: + - npm i -g npm@^3.0.0 +before_script: + - npm prune +script: + - npm run test + - npm run build +after_success: + - npm run semantic-release +branches: + except: + - "/^v\\d+\\.\\d+\\.\\d+$/" diff --git a/node_modules/is-cidr/README.md b/node_modules/is-cidr/README.md new file mode 100644 index 000000000..51aaaf1e1 --- /dev/null +++ b/node_modules/is-cidr/README.md @@ -0,0 +1,58 @@ +# is-cidr + +Check if a string is a valid CIDR + +[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) +[![version](https://img.shields.io/npm/v/is-cidr.svg?style=flat-square)](http://npm.im/is-cidr) +[![MIT License](https://img.shields.io/npm/l/is-cidr.svg?style=flat-square)](http://opensource.org/licenses/MIT) +[![travis build](https://img.shields.io/travis/flipjs/is-cidr.svg?style=flat-square)](https://travis-ci.org/flipjs/is-cidr) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) +[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/) +[![downloads](https://img.shields.io/npm/dm/is-cidr.svg?style=flat-square)](http://npm-stat.com/charts.html?package=is-cidr&from=2016-03-24) + +## Install + +```sh +$ npm install --save is-cidr +``` + +## Usage + +```js +import isCidr from 'is-cidr' // default is isCidrV4 +import { isCidrV4, isCidrV6 } from 'is-cidr' +// OR +var isCidrV4 = require('is-cidr').isCidrV4 +var isCidrV6 = require('is-cidr').isCidrV6 + +// is a CIDR v4 +isCidr('18.101.25.153/24') // true + +// is not a CIDR v4 +isCidrV4('999.999.999.999/12') // false + +// is a CIDR v6 +isCidrV6('fe80:0000:0000:0000:0204:61ff:fe9d:f156') // true + +// is not a CIDR v6 +isCidrV6('fe80:0000:0000:0000:0204:61ff:fe9d:f156/a') // false +``` + +## API + +### isCidr(string) + +Check if a string is CIDR IPv4. + +### isCidrV4(string) + +Check if a string is CIDR IPv4. + +### isCidrV6(string) + +Check if a string is CIDR IPv6. + +## License + +MIT © [Felipe Apostol](https://github.com/flipjs) + diff --git a/node_modules/is-cidr/example/example.js b/node_modules/is-cidr/example/example.js new file mode 100644 index 000000000..2ac23af4e --- /dev/null +++ b/node_modules/is-cidr/example/example.js @@ -0,0 +1,14 @@ +var r = require('../lib') + +var v4true = r.isCidrV4('1.1.1.1/24') +console.log('cidrv4 true is', v4true) + +var v4false = r.isCidrV4('1.1.1.256/24') +console.log('cidrv4 false is', v4false) + +var v6true = r.isCidrV6('fe80:0000:0000:0000:0204:61ff:fe9d:f156') +console.log('cidrv6 true is', v6true) + +var v6false = r.isCidrV6('fe80:0000:0000:0000:0204:61ff:fe9d:f156/sdfsdfs') +console.log('cidrv6 false is', v6false) + diff --git a/node_modules/is-cidr/lib/index.js b/node_modules/is-cidr/lib/index.js new file mode 100644 index 000000000..a36706049 --- /dev/null +++ b/node_modules/is-cidr/lib/index.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isCidrV6 = exports.isCidrV4 = undefined; + +var _cidrRegex = require('cidr-regex'); + +var isCidrV4 = exports.isCidrV4 = function isCidrV4(str) { + return _cidrRegex.cidrv4.test(str); +}; + +var isCidrV6 = exports.isCidrV6 = function isCidrV6(str) { + return _cidrRegex.cidrv6.test(str); +}; + +exports.default = isCidrV4;
\ No newline at end of file diff --git a/node_modules/is-cidr/node_modules/cidr-regex/.npmignore b/node_modules/is-cidr/node_modules/cidr-regex/.npmignore new file mode 100644 index 000000000..8eba6c8dd --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/.npmignore @@ -0,0 +1 @@ +src/ diff --git a/node_modules/is-cidr/node_modules/cidr-regex/README.md b/node_modules/is-cidr/node_modules/cidr-regex/README.md new file mode 100644 index 000000000..de8df4d01 --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/README.md @@ -0,0 +1,49 @@ +# cidr-regex +Regular expression for matching CIDR (Classless Inter-Domain Routing) + +## Install + +```sh +$ npm install --save cidr-regex +``` + +## Usage + +```js +import cidr from 'cidr-regex' // default regex is cidr v4 +import { cidrv4, cidrv6 } from 'cidr-regex' +// OR +var cidrv4 = require('cidr-regex').cidrv4 +var cidrv6 = require('cidr-regex').cidrv6 + +// is a CIDR v4 +cidr.test('18.101.25.153/24') // true + +// is not a CIDR v4 +cidrv4.test('999.999.999.999/12') // false + +// is a CIDR v6 +cidrv6.test('fe80:0000:0000:0000:0204:61ff:fe9d:f156') // true + +// is not a CIDR v6 +cidrv6.test('fe80:0000:0000:0000:0204:61ff:fe9d:f156/a') // false +``` + +## API + +### cidr + +A regex for matching CIDR IPv4 + +### cidrv4 + +A regex for matching CIDR IPv4 + +### cidrv6 + +A regex for matching CIDR IPv6 + +## License + +MIT © [Felipe Apostol](https://github.com/flipjs) + diff --git a/node_modules/is-cidr/node_modules/cidr-regex/lib/index.js b/node_modules/is-cidr/node_modules/cidr-regex/lib/index.js new file mode 100644 index 000000000..44533ae3a --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/lib/index.js @@ -0,0 +1,10 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var cidrv4 = exports.cidrv4 = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/; + +var cidrv6 = exports.cidrv6 = /^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$/; + +exports.default = cidrv4;
\ No newline at end of file diff --git a/node_modules/is-cidr/node_modules/cidr-regex/package.json b/node_modules/is-cidr/node_modules/cidr-regex/package.json new file mode 100644 index 000000000..0c23adf20 --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/package.json @@ -0,0 +1,68 @@ +{ + "_from": "cidr-regex@1.0.6", + "_id": "cidr-regex@1.0.6", + "_inBundle": false, + "_integrity": "sha1-dKv9YZ3zcLnVSrFEdVaOl91kwME=", + "_location": "/is-cidr/cidr-regex", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "cidr-regex@1.0.6", + "name": "cidr-regex", + "escapedName": "cidr-regex", + "rawSpec": "1.0.6", + "saveSpec": null, + "fetchSpec": "1.0.6" + }, + "_requiredBy": [ + "/is-cidr" + ], + "_resolved": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-1.0.6.tgz", + "_shasum": "74abfd619df370b9d54ab14475568e97dd64c0c1", + "_spec": "cidr-regex@1.0.6", + "_where": "/Users/rebecca/code/npm/node_modules/is-cidr", + "author": { + "name": "Felipe Apostol", + "email": "flipjs.io@gmail.com", + "url": "http://flipjs.io/" + }, + "babel": { + "presets": [ + "es2015" + ] + }, + "bugs": { + "url": "https://github.com/flipjs/cidr-regex/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Regular expression for matching CIDR (Classless Inter-Domain Routing)", + "devDependencies": { + "ava": "0.13.0", + "babel-cli": "6.6.5", + "babel-preset-es2015": "6.6.0", + "babel-register": "6.7.2" + }, + "homepage": "https://github.com/flipjs/cidr-regex#readme", + "keywords": [ + "ip", + "ip address", + "cidr", + "netblock", + "regex" + ], + "license": "MIT", + "main": "lib/index.js", + "name": "cidr-regex", + "repository": { + "type": "git", + "url": "git+https://github.com/flipjs/cidr-regex.git" + }, + "scripts": { + "compile": "babel --presets es2015 -d lib/ src/", + "prepublish": "npm run compile", + "test": "ava --require babel-register" + }, + "version": "1.0.6" +} diff --git a/node_modules/is-cidr/node_modules/cidr-regex/test.js b/node_modules/is-cidr/node_modules/cidr-regex/test.js new file mode 100644 index 000000000..c4e4d218b --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/test.js @@ -0,0 +1,200 @@ +'use strict' + +import test from 'ava' +import cidr, { cidrv4, cidrv6 } from './src' + +const v4 = [ + '0.0.0.0/16', + '8.8.8.8/17', + '127.0.0.1/18', + '100.100.100.100/19', + '192.168.0.1/20', + '18.101.25.153/24', + '123.23.34.2/25', + '172.26.168.134/26', + '212.58.241.131/27', + '128.0.0.0/28', + '23.71.254.72/29', + '223.255.255.255/30', + '192.0.2.235/31', + '99.198.122.146/32', + '46.51.197.88/8', + '173.194.34.134/12' +] + +const v4not = [ + '.100.100.100.100/16', + '100..100.100.100./24', + '100.100.100.100./32', + '999.999.999.999/12', + '256.256.256.256/30', + '256.100.100.100.100/26', + '123.123.123/31', + 'http://123.123.123/28', + '1000.2.3.4/14', + '999.2.3.4/8' +] + +const v6 = [ + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/0', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/1', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/2', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/3', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/5', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/6', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/7', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/8', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/9', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/11', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/12', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/13', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/14', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/15', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/16', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/17', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/18', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/19', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/20', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/21', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/22', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/23', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/24', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/25', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/26', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/27', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/28', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/29', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/30', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/31', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/32', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/33', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/34', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/35', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/36', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/37', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/38', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/39', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/40', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/41', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/42', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/43', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/44', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/45', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/46', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/47', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/48', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/49', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/50', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/51', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/52', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/53', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/54', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/55', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/56', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/57', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/58', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/59', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/60', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/61', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/62', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/63', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/64', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/65', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/66', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/67', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/68', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/69', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/70', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/71', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/72', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/73', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/74', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/75', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/76', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/77', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/78', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/79', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/80', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/81', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/82', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/83', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/84', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/85', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/86', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/87', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/88', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/89', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/90', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/91', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/92', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/93', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/94', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/95', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/96', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/97', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/98', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/99', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/100', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/101', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/102', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/103', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/104', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/105', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/106', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/107', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/108', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/109', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/110', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/111', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/112', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/113', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/114', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/115', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/116', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/117', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/118', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/119', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/120', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/121', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/122', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/123', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/124', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/125', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/126', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/127', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/128', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156' +] + +const v6not = [ + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/129', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/a', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/√', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/00', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/03', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/sdfsdfs', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/' +] + +test('cidr v4', (t) => { + v4.forEach((string) => { + t.true(cidr.test(string)) + }) + + v4not.forEach((string) => { + t.false(cidrv4.test(string)) + }) +}) + +test('cidr v6', (t) => { + v6.forEach((string) => { + t.true(cidrv6.test(string)) + }) + + v6not.forEach((string) => { + t.false(cidrv6.test(string)) + }) +}) + diff --git a/node_modules/is-cidr/package.json b/node_modules/is-cidr/package.json new file mode 100644 index 000000000..982863d83 --- /dev/null +++ b/node_modules/is-cidr/package.json @@ -0,0 +1,94 @@ +{ + "_from": "is-cidr", + "_id": "is-cidr@1.0.0", + "_inBundle": false, + "_integrity": "sha1-+1qs9lklUxA1naMsrgPkDGocKvw=", + "_location": "/is-cidr", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "is-cidr", + "name": "is-cidr", + "escapedName": "is-cidr", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-1.0.0.tgz", + "_shasum": "fb5aacf659255310359da32cae03e40c6a1c2afc", + "_spec": "is-cidr", + "_where": "/Users/rebecca/code/npm", + "author": { + "name": "Felipe Apostol", + "email": "flipjs.io@gmail.com", + "url": "http://flipjs.io/" + }, + "babel": { + "presets": [ + "es2015" + ] + }, + "bugs": { + "url": "https://github.com/flipjs/is-cidr/issues" + }, + "bundleDependencies": false, + "config": { + "commitizen": { + "path": "node_modules/cz-conventional-changelog" + }, + "ghooks": { + "pre-commit": "npm run test && npm run build" + } + }, + "dependencies": { + "cidr-regex": "1.0.6" + }, + "deprecated": false, + "description": "Check if a string is a valid CIDR", + "devDependencies": { + "ava": "0.13.0", + "babel-cli": "6.6.5", + "babel-preset-es2015": "6.6.0", + "babel-register": "6.7.2", + "commitizen": "2.7.3", + "cz-conventional-changelog": "1.1.5", + "eslint": "2.4.0", + "eslint-config-standard": "5.1.0", + "eslint-plugin-babel": "3.1.0", + "eslint-plugin-promise": "1.1.0", + "eslint-plugin-standard": "1.3.2", + "ghooks": "1.0.3", + "rimraf": "2.5.2", + "semantic-release": "4.3.5" + }, + "homepage": "https://github.com/flipjs/is-cidr#readme", + "keywords": [ + "ip", + "ip address", + "cidr", + "netblock", + "regex" + ], + "license": "MIT", + "main": "lib/index.js", + "name": "is-cidr", + "repository": { + "type": "git", + "url": "git+https://github.com/flipjs/is-cidr.git" + }, + "scripts": { + "build": "babel --presets es2015 -d lib/ src/", + "clean": "rimraf lib && mkdir lib", + "commit": "git-cz", + "lint": "eslint src/ test/", + "prebuild": "npm run lint && npm run clean", + "semantic-release": "semantic-release pre && npm publish && semantic-release post", + "test": "ava --require babel-register" + }, + "version": "1.0.0" +} diff --git a/node_modules/is-cidr/test/index.test.js b/node_modules/is-cidr/test/index.test.js new file mode 100644 index 000000000..93a801295 --- /dev/null +++ b/node_modules/is-cidr/test/index.test.js @@ -0,0 +1,200 @@ +'use strict' + +import test from 'ava' +import isCidr, { isCidrV4, isCidrV6 } from '../src' + +const v4 = [ + '0.0.0.0/16', + '8.8.8.8/17', + '127.0.0.1/18', + '100.100.100.100/19', + '192.168.0.1/20', + '18.101.25.153/24', + '123.23.34.2/25', + '172.26.168.134/26', + '212.58.241.131/27', + '128.0.0.0/28', + '23.71.254.72/29', + '223.255.255.255/30', + '192.0.2.235/31', + '99.198.122.146/32', + '46.51.197.88/8', + '173.194.34.134/12' +] + +const v4not = [ + '.100.100.100.100/16', + '100..100.100.100./24', + '100.100.100.100./32', + '999.999.999.999/12', + '256.256.256.256/30', + '256.100.100.100.100/26', + '123.123.123/31', + 'http://123.123.123/28', + '1000.2.3.4/14', + '999.2.3.4/8' +] + +const v6 = [ + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/0', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/1', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/2', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/3', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/5', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/6', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/7', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/8', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/9', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/11', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/12', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/13', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/14', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/15', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/16', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/17', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/18', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/19', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/20', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/21', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/22', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/23', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/24', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/25', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/26', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/27', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/28', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/29', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/30', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/31', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/32', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/33', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/34', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/35', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/36', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/37', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/38', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/39', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/40', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/41', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/42', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/43', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/44', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/45', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/46', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/47', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/48', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/49', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/50', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/51', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/52', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/53', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/54', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/55', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/56', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/57', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/58', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/59', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/60', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/61', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/62', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/63', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/64', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/65', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/66', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/67', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/68', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/69', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/70', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/71', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/72', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/73', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/74', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/75', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/76', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/77', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/78', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/79', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/80', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/81', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/82', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/83', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/84', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/85', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/86', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/87', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/88', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/89', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/90', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/91', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/92', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/93', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/94', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/95', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/96', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/97', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/98', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/99', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/100', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/101', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/102', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/103', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/104', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/105', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/106', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/107', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/108', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/109', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/110', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/111', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/112', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/113', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/114', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/115', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/116', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/117', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/118', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/119', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/120', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/121', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/122', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/123', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/124', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/125', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/126', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/127', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/128', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156' +] + +const v6not = [ + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/129', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/a', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/√', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/00', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/03', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/sdfsdfs', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/' +] + +test('cidr v4', (t) => { + v4.forEach((string) => { + t.true(isCidr(string)) + }) + + v4not.forEach((string) => { + t.false(isCidrV4(string)) + }) +}) + +test('cidr v6', (t) => { + v6.forEach((string) => { + t.true(isCidrV6(string)) + }) + + v6not.forEach((string) => { + t.false(isCidrV6(string)) + }) +}) + diff --git a/package-lock.json b/package-lock.json index 73e706af5..9e72968f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -447,6 +447,21 @@ } } }, + "is-cidr": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-1.0.0.tgz", + "integrity": "sha1-+1qs9lklUxA1naMsrgPkDGocKvw=", + "requires": { + "cidr-regex": "1.0.6" + }, + "dependencies": { + "cidr-regex": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-1.0.6.tgz", + "integrity": "sha1-dKv9YZ3zcLnVSrFEdVaOl91kwME=" + } + } + }, "lazy-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lazy-property/-/lazy-property-1.0.0.tgz", diff --git a/package.json b/package.json index a2988c83f..26271335f 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "inherits": "~2.0.3", "ini": "~1.3.4", "init-package-json": "~1.10.1", + "is-cidr": "~1.0.0", "lazy-property": "~1.0.0", "libnpx": "~9.6.0", "lockfile": "~1.0.3", @@ -156,6 +157,7 @@ "inherits", "ini", "init-package-json", + "is-cidr", "JSONStream", "lazy-property", "libnpx", |