You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 05bd2a4
Browse filesBrowse the repository at this point in the historyBrowse files
thrownewaddress_error_1.AddressError('All bytes must be integers between 0 and 255');
351
-
}
352
-
}
361
+
common.assertByteArray(bytes,4,'IPv4',0);
353
362
returnthis.fromUnsignedByteArray(bytes);
354
363
}
355
364
/**
356
-
* Convert an unsigned byte array to an Address4 object
365
+
* Convert an unsigned byte array to an Address4 object. Throws
366
+
* `AddressError` unless given exactly 4 bytes, and rejects values outside
367
+
* 0 to 255 when parsing the resulting address.
368
+
*
369
+
* To convert from a Node.js `Buffer`, spread it:
370
+
* `Address4.fromUnsignedByteArray([...buf])`.
357
371
* @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255)
358
372
* @returns {Address4}
359
373
*/
@@ -383,7 +397,8 @@ class Address4 {
383
397
returnthis.binaryZeroPad().slice(start,end);
384
398
}
385
399
/**
386
-
* Return the reversed ip6.arpa form of the address
400
+
* Return the reversed in-addr.arpa form of the address, e.g.
401
+
* `42.2.0.192.in-addr.arpa.` for `192.0.2.42`.
387
402
* @param {Object} options
388
403
* @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
389
404
* @returns {String}
@@ -403,49 +418,49 @@ class Address4 {
403
418
* @returns {boolean}
404
419
*/
405
420
isMulticast(){
406
-
returnthis.isInSubnet(MULTICAST_V4);
421
+
returnthis.isHostInSubnet(MULTICAST_V4);
407
422
}
408
423
/**
409
424
* Returns true if the address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private address ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`).
* Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)).
417
432
* @returns {boolean}
418
433
*/
419
434
isLoopback(){
420
-
returnthis.isInSubnet(LOOPBACK_V4);
435
+
returnthis.isHostInSubnet(LOOPBACK_V4);
421
436
}
422
437
/**
423
438
* Returns true if the address is in the link-local range `169.254.0.0/16` ([RFC 3927](https://datatracker.ietf.org/doc/html/rfc3927)).
424
439
* @returns {boolean}
425
440
*/
426
441
isLinkLocal(){
427
-
returnthis.isInSubnet(LINK_LOCAL_V4);
442
+
returnthis.isHostInSubnet(LINK_LOCAL_V4);
428
443
}
429
444
/**
430
445
* Returns true if the address is the unspecified address `0.0.0.0`.
431
446
* @returns {boolean}
432
447
*/
433
448
isUnspecified(){
434
-
returnthis.isInSubnet(UNSPECIFIED_V4);
449
+
returnthis.isHostInSubnet(UNSPECIFIED_V4);
435
450
}
436
451
/**
437
452
* Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)).
438
453
* @returns {boolean}
439
454
*/
440
455
isBroadcast(){
441
-
returnthis.isInSubnet(BROADCAST_V4);
456
+
returnthis.isHostInSubnet(BROADCAST_V4);
442
457
}
443
458
/**
444
459
* Returns true if the address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)).
445
460
* @returns {boolean}
446
461
*/
447
462
isCGNAT(){
448
-
returnthis.isInSubnet(CGNAT_V4);
463
+
returnthis.isHostInSubnet(CGNAT_V4);
449
464
}
450
465
/**
451
466
* Returns a zero-padded base-2 string representation of the address
@@ -458,12 +473,17 @@ class Address4 {
458
473
returnthis._binaryZeroPad;
459
474
}
460
475
/**
461
-
* Groups an IPv4 address for inclusion at the end of an IPv6 address
476
+
* Groups an IPv4 address for inclusion at the end of an IPv6 address.
477
+
*
478
+
* Returns an HTML fragment: each half of the address is wrapped in a
479
+
* `<span>` carrying the group classes an address-inspector UI hovers on.
480
+
* The address content is HTML-escaped; anything you concatenate around it
0 commit comments