ip-utilties 3.7.5 → 3.8.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 +8 -0
- package/package.json +1 -1
- package/src/ip.mjs +13 -0
- package/types/ip.d.mts +2 -0
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ encodeIPv4("10.0.0.1") // -> 10n << 24n | 1n;
|
|
|
41
41
|
* [Parameters](#parameters-2)
|
|
42
42
|
* [familyIP](#familyip)
|
|
43
43
|
* [Parameters](#parameters-3)
|
|
44
|
+
* [IPV6\_NODE\_LOCAL\_ALL\_NODES](#ipv6_node_local_all_nodes)
|
|
44
45
|
|
|
45
46
|
## FAMILY\_IPV4
|
|
46
47
|
|
|
@@ -94,6 +95,13 @@ IP address family for a given address.
|
|
|
94
95
|
|
|
95
96
|
Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** 
|
|
96
97
|
|
|
98
|
+
## IPV6\_NODE\_LOCAL\_ALL\_NODES
|
|
99
|
+
|
|
100
|
+
prefix global subnet interface
|
|
101
|
+
ff01:: ff02:: 1
|
|
102
|
+
ff05:: 2 3
|
|
103
|
+
<https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml>
|
|
104
|
+
|
|
97
105
|
# install
|
|
98
106
|
|
|
99
107
|
With [npm](http://npmjs.org) do:
|
package/package.json
CHANGED
package/src/ip.mjs
CHANGED
|
@@ -393,6 +393,19 @@ export function _isLinkLocal(family, address) {
|
|
|
393
393
|
return _wellKnownSubnet(family, address)?.[3] === 1;
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
+
|
|
397
|
+
export function isLoopback(address) {
|
|
398
|
+
const family = _family(address);
|
|
399
|
+
if (family) {
|
|
400
|
+
return _isLoopback(family, _encode(family, address));
|
|
401
|
+
}
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export function _isLoopback(family, address) {
|
|
406
|
+
return _wellKnownSubnet(family, address)?.[3] === 2;
|
|
407
|
+
}
|
|
408
|
+
|
|
396
409
|
export function isUniqueLocal(address) {
|
|
397
410
|
const eaddr = encodeIP(address);
|
|
398
411
|
return eaddr?.[0] >> 9 === 126 ? true : false;
|
package/types/ip.d.mts
CHANGED
|
@@ -54,6 +54,8 @@ export declare function _isLocalhost(family: any, encoded: any): boolean;
|
|
|
54
54
|
export declare function isLocalhost(address: any): boolean;
|
|
55
55
|
export declare function isLinkLocal(address: any): boolean;
|
|
56
56
|
export declare function _isLinkLocal(family: any, address: any): boolean;
|
|
57
|
+
export declare function isLoopback(address: any): boolean;
|
|
58
|
+
export declare function _isLoopback(family: any, address: any): boolean;
|
|
57
59
|
export declare function isUniqueLocal(address: any): boolean;
|
|
58
60
|
export declare function _isUniqueLocal(eaddr: any): boolean;
|
|
59
61
|
export declare function hasWellKnownSubnet(address: any): boolean;
|