ip-utilties 3.7.2 → 3.7.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 +2 -7
package/package.json
CHANGED
package/src/ip.mjs
CHANGED
|
@@ -19,7 +19,6 @@ const ipv4 = {
|
|
|
19
19
|
segmentMask: 0xffn,
|
|
20
20
|
base: 10,
|
|
21
21
|
localHost: new Uint8Array([127, 0, 0, 1]),
|
|
22
|
-
localHostPrefixLenth: 8,
|
|
23
22
|
|
|
24
23
|
// https://www.geeksforgeeks.org/computer-networks/subnet-cheat-sheet/
|
|
25
24
|
wellKnownAddresses: [
|
|
@@ -63,7 +62,6 @@ const ipv6 = {
|
|
|
63
62
|
segmentMask: 0xffffn,
|
|
64
63
|
base: 16,
|
|
65
64
|
localHost: new Uint16Array([0, 0, 0, 0, 0, 0, 0, 1]),
|
|
66
|
-
localHostPrefixLenth: 128,
|
|
67
65
|
wellKnownAddresses: [
|
|
68
66
|
[new Uint16Array([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 64, 64, true],
|
|
69
67
|
[new Uint16Array([0xfd00, 0, 0, 0, 0, 0, 0, 0]), 8, 64, false, true],
|
|
@@ -299,7 +297,8 @@ export function normalizeCIDR(address) {
|
|
|
299
297
|
const wns = _wellKnownSubnet(family, encoded);
|
|
300
298
|
|
|
301
299
|
if (wns) {
|
|
302
|
-
prefixLength
|
|
300
|
+
prefixLength = prefixLength === undefined ? wns[2] : parseInt(prefixLength);
|
|
301
|
+
|
|
303
302
|
prefix = _decode(
|
|
304
303
|
family,
|
|
305
304
|
_prefix(family, encoded, prefixLength),
|
|
@@ -311,10 +310,6 @@ export function normalizeCIDR(address) {
|
|
|
311
310
|
|
|
312
311
|
if (prefixLength) {
|
|
313
312
|
encoded = _prefix(family, prefix, prefixLength);
|
|
314
|
-
} else {
|
|
315
|
-
if (_isLocalhost(family, encoded)) {
|
|
316
|
-
prefixLength = family.localHostPrefixLenth;
|
|
317
|
-
}
|
|
318
313
|
}
|
|
319
314
|
prefix = _decode(family, encoded, prefixLength);
|
|
320
315
|
longPrefix = _decode(family, encoded);
|