ip-utilties 2.0.3 → 3.0.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/package.json +5 -5
- package/src/ip.mjs +13 -6
- package/types/ip.d.mts +6 -3
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ip-utilties",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
7
7
|
},
|
|
8
|
-
"packageManager": "npm@11.
|
|
8
|
+
"packageManager": "npm@11.10.0",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"default": "./src/ip.mjs"
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"ava": "^6.4.1",
|
|
44
|
-
"browser-ava": "^2.3.
|
|
44
|
+
"browser-ava": "^2.3.53",
|
|
45
45
|
"c8": "^10.1.3",
|
|
46
46
|
"documentation": "^14.0.3",
|
|
47
|
-
"semantic-release": "^25.0.
|
|
47
|
+
"semantic-release": "^25.0.3",
|
|
48
48
|
"typescript": "^5.9.3"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
|
-
"node": ">=24.13.
|
|
51
|
+
"node": ">=24.13.1"
|
|
52
52
|
},
|
|
53
53
|
"repository": {
|
|
54
54
|
"type": "git",
|
package/src/ip.mjs
CHANGED
|
@@ -98,7 +98,7 @@ function _decode(family, address, length) {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
let result = "";
|
|
101
|
-
let compressed =
|
|
101
|
+
let compressed = false;
|
|
102
102
|
let word;
|
|
103
103
|
let last = address?.length;
|
|
104
104
|
|
|
@@ -113,13 +113,13 @@ function _decode(family, address, length) {
|
|
|
113
113
|
for (; j < last; j++) {
|
|
114
114
|
word = address[j];
|
|
115
115
|
|
|
116
|
-
if (word !== 0 || !family.compressor || compressed
|
|
116
|
+
if (word !== 0 || !family.compressor || compressed) {
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
if (j > i + 1) {
|
|
122
|
-
compressed
|
|
122
|
+
compressed = true;
|
|
123
123
|
result += family.compressor;
|
|
124
124
|
} else {
|
|
125
125
|
if (result.length > 0) {
|
|
@@ -331,8 +331,15 @@ export function hasWellKnownSubnet(address) {
|
|
|
331
331
|
return isLocalhost(address) || isLinkLocal(address) || isUniqueLocal(address);
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
334
|
+
/*
|
|
335
|
+
* https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml
|
|
336
|
+
*/
|
|
337
|
+
export const IPV6_NODE_LOCAL_ALL_NODES = _encode(ipv6, "ff01::1");
|
|
338
|
+
export const IPV6_NODE_LOCAL_ALL_ROUTERS = _encode(ipv6, "ff01::2");
|
|
339
|
+
export const IPV6_LINK_LOCAL_ALL_NODES = _encode(ipv6, "ff02::1");
|
|
340
|
+
export const IPV6_LINK_LOCAL_ALL_ROUTERS = _encode(ipv6, "ff02::2");
|
|
341
|
+
export const IPV6_SITE_LOCAL_ALL_ROUTERS = _encode(ipv6, "ff05::2");
|
|
342
|
+
export const IPV6_SITE_LOCAL_ALL_DHCP_SERVERS = _encode(ipv6, "ff05::1:3");
|
|
343
|
+
|
|
337
344
|
export const IPV4_LOCALHOST = _encode(ipv4, "127.0.0.1");
|
|
338
345
|
export const IPV6_LOCALHOST = _encode(ipv6, "::1");
|
package/types/ip.d.mts
CHANGED
|
@@ -44,8 +44,11 @@ export function isLocalhost(address: any): boolean;
|
|
|
44
44
|
export function isLinkLocal(address: any): boolean;
|
|
45
45
|
export function isUniqueLocal(address: any): boolean;
|
|
46
46
|
export function hasWellKnownSubnet(address: any): boolean;
|
|
47
|
-
export const
|
|
48
|
-
export const
|
|
49
|
-
export const
|
|
47
|
+
export const IPV6_NODE_LOCAL_ALL_NODES: any;
|
|
48
|
+
export const IPV6_NODE_LOCAL_ALL_ROUTERS: any;
|
|
49
|
+
export const IPV6_LINK_LOCAL_ALL_NODES: any;
|
|
50
|
+
export const IPV6_LINK_LOCAL_ALL_ROUTERS: any;
|
|
51
|
+
export const IPV6_SITE_LOCAL_ALL_ROUTERS: any;
|
|
52
|
+
export const IPV6_SITE_LOCAL_ALL_DHCP_SERVERS: any;
|
|
50
53
|
export const IPV4_LOCALHOST: any;
|
|
51
54
|
export const IPV6_LOCALHOST: any;
|