ip-utilties 3.1.2 → 3.1.3
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/package.json +1 -1
- package/src/ip.mjs +24 -1
package/package.json
CHANGED
package/src/ip.mjs
CHANGED
|
@@ -331,7 +331,11 @@ export function isLocalhost(address) {
|
|
|
331
331
|
|
|
332
332
|
export function isLinkLocal(address) {
|
|
333
333
|
const eaddr = encodeIP(address);
|
|
334
|
-
|
|
334
|
+
if (eaddr) {
|
|
335
|
+
return eaddr[0] === 0xfe80 || (eaddr[0] === 169 && eaddr[1] === 254);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return false;
|
|
335
339
|
}
|
|
336
340
|
|
|
337
341
|
export function isUniqueLocal(address) {
|
|
@@ -343,6 +347,25 @@ export function hasWellKnownSubnet(address) {
|
|
|
343
347
|
return isLocalhost(address) || isLinkLocal(address) || isUniqueLocal(address);
|
|
344
348
|
}
|
|
345
349
|
|
|
350
|
+
/*
|
|
351
|
+
prefix global subnet interface
|
|
352
|
+
|
|
353
|
+
ff01:: ff02:: 1
|
|
354
|
+
ff05:: 2 3
|
|
355
|
+
|
|
356
|
+
https://en.wikipedia.org/wiki/Link-local_address
|
|
357
|
+
fe80:: 64 link local
|
|
358
|
+
169.254. /16 link local
|
|
359
|
+
|
|
360
|
+
https://en.wikipedia.org/wiki/Unique_local_address
|
|
361
|
+
fc00:: 64 unique local
|
|
362
|
+
fd00:: 64 unique local
|
|
363
|
+
|
|
364
|
+
::1 128. local host
|
|
365
|
+
127 8 local host
|
|
366
|
+
172
|
|
367
|
+
*/
|
|
368
|
+
|
|
346
369
|
/*
|
|
347
370
|
* https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml
|
|
348
371
|
*/
|