generate-ip 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -22
- package/dist/cli.min.js +4 -4
- package/docs/README.md +22 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# <picture><source media="(prefers-color-scheme: dark)" srcset="https://
|
|
1
|
+
# <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.generate-ip.org/images/icons/node-graph/white/icon55x49.png?b4eb06e"><img height=32 src="https://media.generate-ip.org/images/icons/node-graph/black/icon55x49.png?b4eb06e"></picture> generate-ip
|
|
2
2
|
|
|
3
3
|
### Randomly generate, format, and validate IPv4 + IPv6 + MAC addresses.
|
|
4
4
|
|
|
5
5
|
<a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
6
|
-
<a href="https://github.com/adamlui/js-utils/releases/tag/generate-ip-2.3.
|
|
6
|
+
<a href="https://github.com/adamlui/js-utils/releases/tag/generate-ip-2.3.1"><img height=31 src="https://img.shields.io/badge/Latest_Build-2.3.1-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
7
7
|
<a href="https://www.npmjs.com/package/generate-ip?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/generate-ip?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
|
|
8
|
-
<a href="https://github.com/adamlui/js-utils/blob/generate-ip-2.3.
|
|
8
|
+
<a href="https://github.com/adamlui/js-utils/blob/generate-ip-2.3.1/generate-ip/dist/generate-ip.min.js"><img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/generate-ip/dist/generate-ip.min.js?branch=generate-ip-2.3.1&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
|
|
9
9
|
<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:generate-ip/src/generate-ip.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Agenerate-ip%2Fsrc%2Fgenerate-ip.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
|
|
10
10
|
<a href="https://github.com/toolleeo/cli-apps#networking"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
11
11
|
<a href="https://www.jsdelivr.com/package/npm/generate-ip?tab=stats"><img height=31 src="https://img.shields.io/jsdelivr/npm/hm/generate-ip?style=for-the-badge&logo=jsdelivr&logoColor=white&label=jsDelivr%20Hits&labelColor=464646&color=49c5d8"></a>
|
|
12
12
|
|
|
13
13
|
<br>
|
|
14
14
|
|
|
15
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
15
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
16
16
|
|
|
17
17
|
## 💡 About
|
|
18
18
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
- **Multi-environment support —** Use in Node.js or the web browser
|
|
24
24
|
- **Command line usable —** Just type `generate-ip`, that's it
|
|
25
25
|
|
|
26
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
26
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
27
27
|
|
|
28
28
|
## ⚡ Installation
|
|
29
29
|
|
|
@@ -47,11 +47,11 @@ $ npm install generate-ip
|
|
|
47
47
|
|
|
48
48
|
<br>
|
|
49
49
|
|
|
50
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
50
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
51
51
|
|
|
52
52
|
## 🔌 Importing the APIs
|
|
53
53
|
|
|
54
|
-
### <img height=18 src="https://media.js-utils.com/images/icons/platforms/node.js/icon25x28.png"> Node.js
|
|
54
|
+
### <img height=18 src="https://media.js-utils.com/images/icons/platforms/node.js/icon25x28.png?3e22bae"> Node.js
|
|
55
55
|
|
|
56
56
|
#### ECMAScript*:
|
|
57
57
|
|
|
@@ -67,28 +67,28 @@ const { ipv4, ipv6, mac } = require('generate-ip');
|
|
|
67
67
|
|
|
68
68
|
###### _*Node.js version 14 or higher required_
|
|
69
69
|
|
|
70
|
-
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/platforms/web/light/icon25.png"><img width=16 src="https://media.js-utils.com/images/icons/platforms/web/dark/icon25.png"></picture> Web
|
|
70
|
+
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/platforms/web/light/icon25.png?3e22bae"><img width=16 src="https://media.js-utils.com/images/icons/platforms/web/dark/icon25.png?3e22bae"></picture> Web
|
|
71
71
|
|
|
72
72
|
#### <> HTML script tag:
|
|
73
73
|
|
|
74
74
|
```html
|
|
75
|
-
<script src="https://cdn.jsdelivr.net/npm/generate-ip@2.3.
|
|
75
|
+
<script src="https://cdn.jsdelivr.net/npm/generate-ip@2.3.1/dist/generate-ip.min.js"></script>
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
#### ES6:
|
|
79
79
|
|
|
80
80
|
```js
|
|
81
81
|
(async () => {
|
|
82
|
-
await import('https://cdn.jsdelivr.net/npm/generate-ip@2.3.
|
|
82
|
+
await import('https://cdn.jsdelivr.net/npm/generate-ip@2.3.1/dist/generate-ip.min.js');
|
|
83
83
|
// Your code here...
|
|
84
84
|
})();
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
### <img height=17 src="https://
|
|
87
|
+
### <img height=17 src="https://media.js-utils.com/images/icons/platforms/tampermonkey/icon28.png?4fd2fa7"><img height=17.5 src="https://media.js-utils.com/images/icons/platforms/violentmonkey/icon25.png?2fe972c"> Greasemonkey
|
|
88
88
|
|
|
89
89
|
```js
|
|
90
90
|
...
|
|
91
|
-
// @require https://cdn.jsdelivr.net/npm/generate-ip@2.3.
|
|
91
|
+
// @require https://cdn.jsdelivr.net/npm/generate-ip@2.3.1/dist/generate-ip.min.js
|
|
92
92
|
// ==/UserScript==
|
|
93
93
|
|
|
94
94
|
// Your code here...
|
|
@@ -96,11 +96,11 @@ const { ipv4, ipv6, mac } = require('generate-ip');
|
|
|
96
96
|
|
|
97
97
|
<br>
|
|
98
98
|
|
|
99
|
-
📝 **Note:** To always import the latest version (not recommended in production!) remove the `@2.3.
|
|
99
|
+
📝 **Note:** To always import the latest version (not recommended in production!) remove the `@2.3.1` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/generate-ip/dist/generate-ip.min.js`
|
|
100
100
|
|
|
101
101
|
<br>
|
|
102
102
|
|
|
103
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
103
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
104
104
|
|
|
105
105
|
## 📋 API usage
|
|
106
106
|
|
|
@@ -331,7 +331,7 @@ Name | Type | Description | Default Value
|
|
|
331
331
|
|
|
332
332
|
<br>
|
|
333
333
|
|
|
334
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
334
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
335
335
|
|
|
336
336
|
## 💻 Command line usage
|
|
337
337
|
|
|
@@ -343,7 +343,7 @@ $ generate-ip
|
|
|
343
343
|
|
|
344
344
|
Sample output:
|
|
345
345
|
|
|
346
|
-
<img src="https://media.generate-ip.org/images/screenshots/cli/generate-ip-cmd-output.
|
|
346
|
+
<img src="https://media.generate-ip.org/images/screenshots/cli/generate-ip-cmd-output.png?7b16322">
|
|
347
347
|
|
|
348
348
|
📝 **Note:** To generate multiple IP addresses, pass `--qty=n` where `n` is the number of IPs to generate.
|
|
349
349
|
|
|
@@ -365,7 +365,7 @@ Info commands:
|
|
|
365
365
|
|
|
366
366
|
<br>
|
|
367
367
|
|
|
368
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
368
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
369
369
|
|
|
370
370
|
## 🏛️ MIT License
|
|
371
371
|
|
|
@@ -379,11 +379,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
379
379
|
|
|
380
380
|
<br>
|
|
381
381
|
|
|
382
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
382
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
383
383
|
|
|
384
384
|
## 🛠️ Related utilities
|
|
385
385
|
|
|
386
|
-
### [🔒 generate-pw](../generate-pw) <a href="https://github.com/toolleeo/cli-apps#password-managers"><img height=18 src="https://
|
|
386
|
+
### [🔒 generate-pw](../generate-pw) <a href="https://github.com/toolleeo/cli-apps#password-managers"><img height=18 src="https://media.js-utils.com/images/badges/awesome/badge.svg?7b16322"></a>
|
|
387
387
|
|
|
388
388
|
> Randomly generate, strengthen, and validate cryptographically-secure passwords.
|
|
389
389
|
<br>[Install](https://docs.generatepw.org/#-installation) /
|
|
@@ -392,7 +392,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
392
392
|
[CLI usage](https://docs.generatepw.org/#-command-line-usage) /
|
|
393
393
|
[Discuss](https://github.js-utils.com/discussions)
|
|
394
394
|
|
|
395
|
-
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://
|
|
395
|
+
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.geolocatejs.org/images/icons/wire-globe/white/icon32.png?e735b99"><img height=22 src="https://media.geolocatejs.org/images/icons/wire-globe/black/icon32.png?e735b99"></picture> [geolocate](https://js-utils.com/geolocate)
|
|
396
396
|
|
|
397
397
|
> Fetch IP geolocation data from the CLI.
|
|
398
398
|
<br>[Install](https://docs.geolocatejs.org/#-installation) /
|
|
@@ -403,8 +403,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
403
403
|
|
|
404
404
|
<br>
|
|
405
405
|
|
|
406
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
406
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
407
407
|
|
|
408
|
-
<picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/home/white/icon32x27.png"><img height=13 src="https://media.js-utils.com/images/icons/home/dark-gray/icon32x27.png"></picture> <a href="https://js-utils.com">**More JavaScript utilities**</a> /
|
|
408
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/home/white/icon32x27.png?e735b99"><img height=13 src="https://media.js-utils.com/images/icons/home/dark-gray/icon32x27.png?e735b99"></picture> <a href="https://js-utils.com">**More JavaScript utilities**</a> /
|
|
409
409
|
<a href="https://github.js-utils.com/discussions">Discuss</a> /
|
|
410
410
|
<a href="#-generate-ip">Back to top ↑</a>
|
package/dist/cli.min.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* Source: https://code.generate-ip.org
|
|
5
5
|
* Documentation: https://docs.generate-ip.org
|
|
6
6
|
*/
|
|
7
|
-
const pkgName="generate-ip",copyright="© 2024 Adam Lui & contributors under the MIT license.",cmdFormat="generate-ip [options|commands]",srcURL="https://code.generate-ip.org",docURL="https://docs.generate-ip.org/#-command-line-usage";(async()=>{const e=require(__dirname.match(/src/)?"./generate-ip":"./generate-ip.min")["ipv4"],r=require("fs"),n=require("path"),s=require("child_process")["execSync"],t="[0m",i="[1;91m",a="[1;97m";let l="en";if("win32"==process.platform)try{l=s("(Get-Culture).TwoLetterISOLanguageName",{shell:"powershell",encoding:"utf-8"}).trim()}catch(e){}else{var c=process.env;l=(c.LANG||c.LANGUAGE||c.LC_ALL||c.LC_MESSAGES||c.LC_NAME||"en").split(".")[0]}let p={};var o,c=new Promise((t,i)=>{const a="https://cdn.jsdelivr.net/gh/adamlui/js-utils/generate-ip/_locales/",e=(l?l.replace("-","_"):"en")+"/";let c=a+e+"messages.json",p=0;d(c).then(async function o(e){try{const r=await e.json(),n={};for(const s in r)"object"==typeof r[s]&&"message"in r[s]&&(n[s]=r[s].message);t(n)}catch(e){if(3==++p)return t({});d(c=l.includes("-")&&1==p?c.replace(/([^_]*)_[^/]*(\/.*)/,"$1$2"):a+"en/messages.json").then(o).catch(i)}}).catch(i)});try{p=await c}catch(e){}const m={},f={paramOptions:{qty:/^--?qu?a?n?ti?t?y(?:=.*|$)/},flags:{quietMode:/^--?q(?:uiet)?(?:-?mode)?$/},infoCmds:{help:/^--?h(?:elp)?$/,version:/^--?ve?r?s?i?o?n?$/}};if(process.argv.forEach(o=>{var e,r,n;o.startsWith("-")&&(e=Object.keys(f.paramOptions).find(e=>f.paramOptions[e].test(o)),n=Object.keys(f.flags).find(e=>f.flags[e].test(o)),r=Object.keys(f.infoCmds).find(e=>f.infoCmds[e].test(o)),n?m[n]=!0:e?(o
|
|
7
|
+
const pkgName="generate-ip",copyright="© 2024 Adam Lui & contributors under the MIT license.",cmdFormat="generate-ip [options|commands]",srcURL="https://code.generate-ip.org",docURL="https://docs.generate-ip.org/#-command-line-usage";(async()=>{const e=require(__dirname.match(/src/)?"./generate-ip":"./generate-ip.min")["ipv4"],r=require("fs"),n=require("path"),s=require("child_process")["execSync"],t="[0m",i="[1;91m",a="[1;97m";let l="en";if("win32"==process.platform)try{l=s("(Get-Culture).TwoLetterISOLanguageName",{shell:"powershell",encoding:"utf-8"}).trim()}catch(e){}else{var c=process.env;l=(c.LANG||c.LANGUAGE||c.LC_ALL||c.LC_MESSAGES||c.LC_NAME||"en").split(".")[0]}let p={};var o,c=new Promise((t,i)=>{const a="https://cdn.jsdelivr.net/gh/adamlui/js-utils@8f3dcf8e2d67ebc399b5695bf6d08b9568d75f10/generate-ip/_locales/",e=(l?l.replace("-","_"):"en")+"/";let c=a+e+"messages.json",p=0;d(c).then(async function o(e){try{const r=await e.json(),n={};for(const s in r)"object"==typeof r[s]&&"message"in r[s]&&(n[s]=r[s].message);t(n)}catch(e){if(3==++p)return t({});d(c=l.includes("-")&&1==p?c.replace(/([^_]*)_[^/]*(\/.*)/,"$1$2"):a+"en/messages.json").then(o).catch(i)}}).catch(i)});try{p=await c}catch(e){}const m={},f={paramOptions:{qty:/^--?qu?a?n?ti?t?y(?:=.*|$)/},flags:{quietMode:/^--?q(?:uiet)?(?:-?mode)?$/},infoCmds:{help:/^--?h(?:elp)?$/,version:/^--?ve?r?s?i?o?n?$/}};if(process.argv.forEach(o=>{var e,r,n;o.startsWith("-")&&(e=Object.keys(f.paramOptions).find(e=>f.paramOptions[e].test(o)),n=Object.keys(f.flags).find(e=>f.flags[e].test(o)),r=Object.keys(f.infoCmds).find(e=>f.infoCmds[e].test(o)),n?m[n]=!0:e?(/=.+/.test(o)||(console.error(`
|
|
8
8
|
${i+(p.prefix_error||"ERROR")}: `+`Arg [--${o.replace(/-/g,"")}] `+`${p.error_noEqual||"requires '=' followed by a value"}.${t}`),u(),process.exit(1)),n=o.split("=")[1],m[e]=parseInt(n)||n):r||(console.error(`
|
|
9
9
|
${i+(p.prefix_error||"ERROR")}: `+`Arg [${o}] ${p.error_notRecognized||"not recognized"}.[0m`),console.info(`
|
|
10
|
-
${"[1;33m"+(p.info_validArgs||"Valid arguments are below")}.[0m`),h(["paramOptions","flags","infoCmds"]),process.exit(1)))}),
|
|
11
|
-
${p.
|
|
12
|
-
${
|
|
10
|
+
${"[1;33m"+(p.info_validArgs||"Valid arguments are below")}.[0m`),h(["paramOptions","flags","infoCmds"]),process.exit(1)))}),m.qty&&(isNaN(m.qty)||m.qty<1)&&(console.error(`
|
|
11
|
+
${i+(p.prefix_error||"ERROR")}: [qty] `+`${p.error_nonPositiveNum||"argument can only be > 0"}.${t}`),u(),process.exit(1)),process.argv.some(e=>f.infoCmds.help.test(e)))h();else if(process.argv.some(e=>f.infoCmds.version.test(e))){c=s(`npm view ${pkgName} version`).toString().trim()||"none";let e,o=process.cwd();for(;"/"!=o;){var g=n.join(o,"package.json");if(r.existsSync(g)){g=require(g);e=(g.dependencies?.[pkgName]||g.devDependencies?.[pkgName])?.match(/(\d+\.\d+\.\d+)/)[0]||"none";break}o=n.dirname(o)}console.info(`
|
|
12
|
+
${p.prefix_globalVer||"Global version"}: `+c),console.info(`${p.prefix_localVer||"Local version"}: `+e)}else{c=e.generate({qty:m.qty||1,verbose:!m.quietMode});o=`
|
|
13
13
|
${p.info_copying||"Copying to clipboard"}...`,m.quietMode||console.info(o),o=Array.isArray(c)?c.join("\n"):c,"darwin"==process.platform?s(`printf "${o}" | pbcopy`):"linux"==process.platform?s(`printf "${o}" | xclip -selection clipboard`):"win32"==process.platform&&s(`Set-Clipboard -Value "${o}"`,{shell:"powershell"})}function d(n){return new Promise((r,e)=>{var o=n.match(/^([^:]+):\/\//)[1];/^https?$/.test(o)||e(new Error(`${p.error_invalidURL||"Invalid URL"}.`)),require(o).get(n,e=>{let o="";e.on("data",e=>o+=e),e.on("end",()=>r({json:()=>JSON.parse(o)}))}).on("error",e)})}function h(e=["header","usage","paramOptions","flags","infoCmds"]){var o=`[106m[30m ${pkgName} [0m `;const r={header:["\n├ "+o+(p.appCopyright||copyright),o+(p.prefix_source||"Source")+": "+srcURL],usage:[`
|
|
14
14
|
${a}o ${p.helpSection_usage||"Usage"}:[0m`," [1;97m» [1;92m"+cmdFormat+t],paramOptions:[`
|
|
15
15
|
${a}o ${p.helpSection_paramOptions||"Parameter options"}:[0m`,` --qty=n ${p.optionDesc_qty||"Generate n IP address(es)"}.`],flags:[`
|
package/docs/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# <picture><source media="(prefers-color-scheme: dark)" srcset="https://
|
|
1
|
+
# <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.generate-ip.org/images/icons/node-graph/white/icon55x49.png?b4eb06e"><img height=32 src="https://media.generate-ip.org/images/icons/node-graph/black/icon55x49.png?b4eb06e"></picture> generate-ip
|
|
2
2
|
|
|
3
3
|
### Randomly generate, format, and validate IPv4 + IPv6 + MAC addresses.
|
|
4
4
|
|
|
5
5
|
<a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
6
|
-
<a href="https://github.com/adamlui/js-utils/releases/tag/generate-ip-2.3.
|
|
6
|
+
<a href="https://github.com/adamlui/js-utils/releases/tag/generate-ip-2.3.1"><img height=31 src="https://img.shields.io/badge/Latest_Build-2.3.1-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
7
7
|
<a href="https://www.npmjs.com/package/generate-ip?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/generate-ip?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
|
|
8
|
-
<a href="https://github.com/adamlui/js-utils/blob/generate-ip-2.3.
|
|
8
|
+
<a href="https://github.com/adamlui/js-utils/blob/generate-ip-2.3.1/generate-ip/dist/generate-ip.min.js"><img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/generate-ip/dist/generate-ip.min.js?branch=generate-ip-2.3.1&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
|
|
9
9
|
<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:generate-ip/src/generate-ip.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Agenerate-ip%2Fsrc%2Fgenerate-ip.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
|
|
10
10
|
<a href="https://github.com/toolleeo/cli-apps#networking"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
11
11
|
<a href="https://www.jsdelivr.com/package/npm/generate-ip?tab=stats"><img height=31 src="https://img.shields.io/jsdelivr/npm/hm/generate-ip?style=for-the-badge&logo=jsdelivr&logoColor=white&label=jsDelivr%20Hits&labelColor=464646&color=49c5d8"></a>
|
|
12
12
|
|
|
13
13
|
<br>
|
|
14
14
|
|
|
15
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
15
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
16
16
|
|
|
17
17
|
## 💡 About
|
|
18
18
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
- **Multi-environment support —** Use in Node.js or the web browser
|
|
24
24
|
- **Command line usable —** Just type `generate-ip`, that's it
|
|
25
25
|
|
|
26
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
26
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
27
27
|
|
|
28
28
|
## ⚡ Installation
|
|
29
29
|
|
|
@@ -47,11 +47,11 @@ $ npm install generate-ip
|
|
|
47
47
|
|
|
48
48
|
<br>
|
|
49
49
|
|
|
50
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
50
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
51
51
|
|
|
52
52
|
## 🔌 Importing the APIs
|
|
53
53
|
|
|
54
|
-
### <img height=18 src="https://media.js-utils.com/images/icons/platforms/node.js/icon25x28.png"> Node.js
|
|
54
|
+
### <img height=18 src="https://media.js-utils.com/images/icons/platforms/node.js/icon25x28.png?3e22bae"> Node.js
|
|
55
55
|
|
|
56
56
|
#### ECMAScript*:
|
|
57
57
|
|
|
@@ -67,28 +67,28 @@ const { ipv4, ipv6, mac } = require('generate-ip');
|
|
|
67
67
|
|
|
68
68
|
###### _*Node.js version 14 or higher required_
|
|
69
69
|
|
|
70
|
-
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/platforms/web/light/icon25.png"><img width=16 src="https://media.js-utils.com/images/icons/platforms/web/dark/icon25.png"></picture> Web
|
|
70
|
+
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/platforms/web/light/icon25.png?3e22bae"><img width=16 src="https://media.js-utils.com/images/icons/platforms/web/dark/icon25.png?3e22bae"></picture> Web
|
|
71
71
|
|
|
72
72
|
#### <> HTML script tag:
|
|
73
73
|
|
|
74
74
|
```html
|
|
75
|
-
<script src="https://cdn.jsdelivr.net/npm/generate-ip@2.3.
|
|
75
|
+
<script src="https://cdn.jsdelivr.net/npm/generate-ip@2.3.1/dist/generate-ip.min.js"></script>
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
#### ES6:
|
|
79
79
|
|
|
80
80
|
```js
|
|
81
81
|
(async () => {
|
|
82
|
-
await import('https://cdn.jsdelivr.net/npm/generate-ip@2.3.
|
|
82
|
+
await import('https://cdn.jsdelivr.net/npm/generate-ip@2.3.1/dist/generate-ip.min.js');
|
|
83
83
|
// Your code here...
|
|
84
84
|
})();
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
### <img height=17 src="https://
|
|
87
|
+
### <img height=17 src="https://media.js-utils.com/images/icons/platforms/tampermonkey/icon28.png?4fd2fa7"><img height=17.5 src="https://media.js-utils.com/images/icons/platforms/violentmonkey/icon25.png?2fe972c"> Greasemonkey
|
|
88
88
|
|
|
89
89
|
```js
|
|
90
90
|
...
|
|
91
|
-
// @require https://cdn.jsdelivr.net/npm/generate-ip@2.3.
|
|
91
|
+
// @require https://cdn.jsdelivr.net/npm/generate-ip@2.3.1/dist/generate-ip.min.js
|
|
92
92
|
// ==/UserScript==
|
|
93
93
|
|
|
94
94
|
// Your code here...
|
|
@@ -96,11 +96,11 @@ const { ipv4, ipv6, mac } = require('generate-ip');
|
|
|
96
96
|
|
|
97
97
|
<br>
|
|
98
98
|
|
|
99
|
-
📝 **Note:** To always import the latest version (not recommended in production!) remove the `@2.3.
|
|
99
|
+
📝 **Note:** To always import the latest version (not recommended in production!) remove the `@2.3.1` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/generate-ip/dist/generate-ip.min.js`
|
|
100
100
|
|
|
101
101
|
<br>
|
|
102
102
|
|
|
103
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
103
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
104
104
|
|
|
105
105
|
## 📋 API usage
|
|
106
106
|
|
|
@@ -331,7 +331,7 @@ Name | Type | Description | Default Value
|
|
|
331
331
|
|
|
332
332
|
<br>
|
|
333
333
|
|
|
334
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
334
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
335
335
|
|
|
336
336
|
## 💻 Command line usage
|
|
337
337
|
|
|
@@ -343,7 +343,7 @@ $ generate-ip
|
|
|
343
343
|
|
|
344
344
|
Sample output:
|
|
345
345
|
|
|
346
|
-
<img src="https://media.generate-ip.org/images/screenshots/cli/generate-ip-cmd-output.
|
|
346
|
+
<img src="https://media.generate-ip.org/images/screenshots/cli/generate-ip-cmd-output.png?7b16322">
|
|
347
347
|
|
|
348
348
|
📝 **Note:** To generate multiple IP addresses, pass `--qty=n` where `n` is the number of IPs to generate.
|
|
349
349
|
|
|
@@ -365,7 +365,7 @@ Info commands:
|
|
|
365
365
|
|
|
366
366
|
<br>
|
|
367
367
|
|
|
368
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
368
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
369
369
|
|
|
370
370
|
## 🏛️ MIT License
|
|
371
371
|
|
|
@@ -379,11 +379,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
379
379
|
|
|
380
380
|
<br>
|
|
381
381
|
|
|
382
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
382
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
383
383
|
|
|
384
384
|
## 🛠️ Related utilities
|
|
385
385
|
|
|
386
|
-
### [🔒 generate-pw](../generate-pw) <a href="https://github.com/toolleeo/cli-apps#password-managers"><img height=18 src="https://
|
|
386
|
+
### [🔒 generate-pw](../generate-pw) <a href="https://github.com/toolleeo/cli-apps#password-managers"><img height=18 src="https://media.js-utils.com/images/badges/awesome/badge.svg?7b16322"></a>
|
|
387
387
|
|
|
388
388
|
> Randomly generate, strengthen, and validate cryptographically-secure passwords.
|
|
389
389
|
<br>[Install](https://docs.generatepw.org/#-installation) /
|
|
@@ -392,7 +392,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
392
392
|
[CLI usage](https://docs.generatepw.org/#-command-line-usage) /
|
|
393
393
|
[Discuss](https://github.js-utils.com/discussions)
|
|
394
394
|
|
|
395
|
-
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://
|
|
395
|
+
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.geolocatejs.org/images/icons/wire-globe/white/icon32.png?e735b99"><img height=22 src="https://media.geolocatejs.org/images/icons/wire-globe/black/icon32.png?e735b99"></picture> [geolocate](https://js-utils.com/geolocate)
|
|
396
396
|
|
|
397
397
|
> Fetch IP geolocation data from the CLI.
|
|
398
398
|
<br>[Install](https://docs.geolocatejs.org/#-installation) /
|
|
@@ -403,8 +403,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
403
403
|
|
|
404
404
|
<br>
|
|
405
405
|
|
|
406
|
-
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png">
|
|
406
|
+
<img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
|
|
407
407
|
|
|
408
|
-
<picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/home/white/icon32x27.png"><img height=13 src="https://media.js-utils.com/images/icons/home/dark-gray/icon32x27.png"></picture> <a href="https://js-utils.com">**More JavaScript utilities**</a> /
|
|
408
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/home/white/icon32x27.png?e735b99"><img height=13 src="https://media.js-utils.com/images/icons/home/dark-gray/icon32x27.png?e735b99"></picture> <a href="https://js-utils.com">**More JavaScript utilities**</a> /
|
|
409
409
|
<a href="https://github.js-utils.com/discussions">Discuss</a> /
|
|
410
410
|
<a href="#-generate-ip">Back to top ↑</a>
|