ip-utilties 1.3.3 → 1.4.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 +4 -4
- package/src/ip.mjs +10 -1
- package/types/ip.d.mts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ip-utilties",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"ava": "^6.3.0",
|
|
43
|
-
"browser-ava": "^2.3.
|
|
43
|
+
"browser-ava": "^2.3.31",
|
|
44
44
|
"c8": "^10.1.3",
|
|
45
45
|
"documentation": "^14.0.3",
|
|
46
|
-
"semantic-release": "^24.2.
|
|
46
|
+
"semantic-release": "^24.2.5",
|
|
47
47
|
"typescript": "^5.8.3"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
|
-
"node": ">=22.
|
|
50
|
+
"node": ">=22.16.0"
|
|
51
51
|
},
|
|
52
52
|
"repository": {
|
|
53
53
|
"type": "git",
|
package/src/ip.mjs
CHANGED
|
@@ -229,6 +229,10 @@ export function normalizeCIDR(address) {
|
|
|
229
229
|
prefix = "fe80::";
|
|
230
230
|
longPrefix = prefix;
|
|
231
231
|
prefixLength = 64;
|
|
232
|
+
} else if (isUniqueLocal(address)) {
|
|
233
|
+
prefix = "fd00::";
|
|
234
|
+
longPrefix = prefix;
|
|
235
|
+
prefixLength = 7;
|
|
232
236
|
} else {
|
|
233
237
|
const family = /*_family(prefix); */ isIPv6(prefix) ? ipv6 : ipv4;
|
|
234
238
|
let n;
|
|
@@ -296,8 +300,13 @@ export function isLinkLocal(address) {
|
|
|
296
300
|
return eaddr?.[0] === 0xfe80;
|
|
297
301
|
}
|
|
298
302
|
|
|
303
|
+
export function isUniqueLocal(address) {
|
|
304
|
+
const eaddr = encodeIP(address);
|
|
305
|
+
return eaddr?.[0] === 0xfc00 || eaddr?.[0] === 0xfd00;
|
|
306
|
+
}
|
|
307
|
+
|
|
299
308
|
export function hasWellKnownSubnet(address) {
|
|
300
|
-
return isLocalhost(address) || isLinkLocal(address);
|
|
309
|
+
return isLocalhost(address) || isLinkLocal(address) || isUniqueLocal(address);
|
|
301
310
|
}
|
|
302
311
|
|
|
303
312
|
export const IPV6_LINK_LOCAL_BROADCAST = _encode(ipv6, "ff02::1");
|
package/types/ip.d.mts
CHANGED
|
@@ -27,6 +27,7 @@ export function normalizeIP(address: any): string;
|
|
|
27
27
|
export function reverseArpa(address: any): string;
|
|
28
28
|
export function isLocalhost(address: any): boolean;
|
|
29
29
|
export function isLinkLocal(address: any): boolean;
|
|
30
|
+
export function isUniqueLocal(address: any): boolean;
|
|
30
31
|
export function hasWellKnownSubnet(address: any): boolean;
|
|
31
32
|
export const IPV6_LINK_LOCAL_BROADCAST: any;
|
|
32
33
|
export const IPV6_ROUTER_BROADCAST: any;
|