mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-09-02 05:55:10 +09:00
chore: Update dist
This commit is contained in:
+1
-1
@@ -1485,7 +1485,7 @@ Apache-2.0
|
||||
|
||||
The following npm package may be included in this product:
|
||||
|
||||
- ip-address@10.2.0
|
||||
- ip-address@10.4.0
|
||||
|
||||
This package contains the following license:
|
||||
|
||||
|
||||
+189
-61
@@ -48650,8 +48650,10 @@ var require_common2 = __commonJS({
|
||||
"use strict";
|
||||
Object.defineProperty(exports2, "__esModule", { value: true });
|
||||
exports2.isInSubnet = isInSubnet;
|
||||
exports2.isHostInSubnet = isHostInSubnet;
|
||||
exports2.isCorrect = isCorrect;
|
||||
exports2.prefixLengthFromMask = prefixLengthFromMask;
|
||||
exports2.assertByteArray = assertByteArray;
|
||||
exports2.numberToPaddedHex = numberToPaddedHex;
|
||||
exports2.stringToPaddedHex = stringToPaddedHex;
|
||||
exports2.testBit = testBit;
|
||||
@@ -48660,13 +48662,13 @@ var require_common2 = __commonJS({
|
||||
if (this.subnetMask < address.subnetMask) {
|
||||
return false;
|
||||
}
|
||||
if (this.mask(address.subnetMask) === address.mask()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return isHostInSubnet.call(this, address);
|
||||
}
|
||||
function isHostInSubnet(address) {
|
||||
return this.mask(address.subnetMask) === address.mask();
|
||||
}
|
||||
function isCorrect(defaultBits) {
|
||||
return function() {
|
||||
return function isCorrectForm() {
|
||||
if (this.addressMinusSuffix !== this.correctForm()) {
|
||||
return false;
|
||||
}
|
||||
@@ -48690,6 +48692,16 @@ var require_common2 = __commonJS({
|
||||
}
|
||||
return firstZero;
|
||||
}
|
||||
function assertByteArray(bytes, byteCount, family, minimum) {
|
||||
if (bytes.length !== byteCount) {
|
||||
throw new address_error_1.AddressError(`${family} addresses require exactly ${byteCount} bytes`);
|
||||
}
|
||||
for (let i5 = 0; i5 < bytes.length; i5++) {
|
||||
if (!Number.isInteger(bytes[i5]) || bytes[i5] < minimum || bytes[i5] > 255) {
|
||||
throw new address_error_1.AddressError(`All bytes must be integers between ${minimum} and 255`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function numberToPaddedHex(number) {
|
||||
return number.toString(16).padStart(2, "0");
|
||||
}
|
||||
@@ -48715,7 +48727,7 @@ var require_constants7 = __commonJS({
|
||||
exports2.RE_SUBNET_STRING = exports2.RE_ADDRESS = exports2.GROUPS = exports2.BITS = void 0;
|
||||
exports2.BITS = 32;
|
||||
exports2.GROUPS = 4;
|
||||
exports2.RE_ADDRESS = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g;
|
||||
exports2.RE_ADDRESS = /^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/g;
|
||||
exports2.RE_SUBNET_STRING = /\/\d{1,2}$/;
|
||||
}
|
||||
});
|
||||
@@ -48759,6 +48771,7 @@ var require_ipv4 = __commonJS({
|
||||
var isCorrect4 = common.isCorrect(constants4.BITS);
|
||||
var Address4 = class _Address4 {
|
||||
constructor(address) {
|
||||
this.addressMinusSuffix = "";
|
||||
this.groups = constants4.GROUPS;
|
||||
this.parsedAddress = [];
|
||||
this.parsedSubnet = "";
|
||||
@@ -48767,6 +48780,7 @@ var require_ipv4 = __commonJS({
|
||||
this.v4 = true;
|
||||
this.isCorrect = isCorrect4;
|
||||
this.isInSubnet = common.isInSubnet;
|
||||
this.isHostInSubnet = common.isHostInSubnet;
|
||||
this.address = address;
|
||||
const subnet = constants4.RE_SUBNET_STRING.exec(address);
|
||||
if (subnet) {
|
||||
@@ -48792,7 +48806,7 @@ var require_ipv4 = __commonJS({
|
||||
try {
|
||||
new _Address4(address);
|
||||
return true;
|
||||
} catch (e5) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -48804,6 +48818,9 @@ var require_ipv4 = __commonJS({
|
||||
*/
|
||||
parse(address) {
|
||||
const groups = address.split(".");
|
||||
if (groups.some((group4) => /^0\d/.test(group4))) {
|
||||
throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.");
|
||||
}
|
||||
if (!address.match(constants4.RE_ADDRESS)) {
|
||||
throw new address_error_1.AddressError("Invalid IPv4 address.");
|
||||
}
|
||||
@@ -49039,7 +49056,7 @@ var require_ipv4 = __commonJS({
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromBigInt(bigInt) {
|
||||
if (bigInt < 0n || bigInt > 0xffffffffn) {
|
||||
if (bigInt < BigInt(0) || bigInt > BigInt(4294967295)) {
|
||||
throw new address_error_1.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1");
|
||||
}
|
||||
return _Address4.fromHex(bigInt.toString(16).padStart(8, "0"));
|
||||
@@ -49052,14 +49069,7 @@ var require_ipv4 = __commonJS({
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromByteArray(bytes) {
|
||||
if (bytes.length !== 4) {
|
||||
throw new address_error_1.AddressError("IPv4 addresses require exactly 4 bytes");
|
||||
}
|
||||
for (let i5 = 0; i5 < bytes.length; i5++) {
|
||||
if (!Number.isInteger(bytes[i5]) || bytes[i5] < 0 || bytes[i5] > 255) {
|
||||
throw new address_error_1.AddressError("All bytes must be integers between 0 and 255");
|
||||
}
|
||||
}
|
||||
common.assertByteArray(bytes, 4, "IPv4", 0);
|
||||
return this.fromUnsignedByteArray(bytes);
|
||||
}
|
||||
/**
|
||||
@@ -49113,49 +49123,49 @@ var require_ipv4 = __commonJS({
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMulticast() {
|
||||
return this.isInSubnet(MULTICAST_V4);
|
||||
return this.isHostInSubnet(MULTICAST_V4);
|
||||
}
|
||||
/**
|
||||
* 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 {boolean}
|
||||
*/
|
||||
isPrivate() {
|
||||
return PRIVATE_V4.some((subnet) => this.isInSubnet(subnet));
|
||||
return PRIVATE_V4.some((subnet) => this.isHostInSubnet(subnet));
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)).
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isLoopback() {
|
||||
return this.isInSubnet(LOOPBACK_V4);
|
||||
return this.isHostInSubnet(LOOPBACK_V4);
|
||||
}
|
||||
/**
|
||||
* 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)).
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isLinkLocal() {
|
||||
return this.isInSubnet(LINK_LOCAL_V4);
|
||||
return this.isHostInSubnet(LINK_LOCAL_V4);
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is the unspecified address `0.0.0.0`.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isUnspecified() {
|
||||
return this.isInSubnet(UNSPECIFIED_V4);
|
||||
return this.isHostInSubnet(UNSPECIFIED_V4);
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)).
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isBroadcast() {
|
||||
return this.isInSubnet(BROADCAST_V4);
|
||||
return this.isHostInSubnet(BROADCAST_V4);
|
||||
}
|
||||
/**
|
||||
* 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)).
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isCGNAT() {
|
||||
return this.isInSubnet(CGNAT_V4);
|
||||
return this.isHostInSubnet(CGNAT_V4);
|
||||
}
|
||||
/**
|
||||
* Returns a zero-padded base-2 string representation of the address
|
||||
@@ -49173,7 +49183,7 @@ var require_ipv4 = __commonJS({
|
||||
*/
|
||||
groupForV6() {
|
||||
const segments = this.parsedAddress;
|
||||
return this.address.replace(constants4.RE_ADDRESS, `<span class="hover-group group-v4 group-6">${segments.slice(0, 2).join(".")}</span>.<span class="hover-group group-v4 group-7">${segments.slice(2, 4).join(".")}</span>`);
|
||||
return this.correctForm().replace(constants4.RE_ADDRESS, `<span class="hover-group group-v4 group-6">${segments.slice(0, 2).join(".")}</span>.<span class="hover-group group-v4 group-7">${segments.slice(2, 4).join(".")}</span>`);
|
||||
}
|
||||
};
|
||||
exports2.Address4 = Address4;
|
||||
@@ -49230,6 +49240,7 @@ var require_constants8 = __commonJS({
|
||||
"ff05::1:3/128": "Multicast (All DHCP servers in this site)",
|
||||
"::/128": "Unspecified",
|
||||
"::1/128": "Loopback",
|
||||
"::ffff:0:0/96": "IPv4-mapped",
|
||||
"ff00::/8": "Multicast",
|
||||
"fe80::/10": "Link-local unicast",
|
||||
"fc00::/7": "Unique local",
|
||||
@@ -49242,8 +49253,8 @@ var require_constants8 = __commonJS({
|
||||
exports2.RE_BAD_ADDRESS = /([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;
|
||||
exports2.RE_SUBNET_STRING = /\/\d{1,3}(?=%|$)/;
|
||||
exports2.RE_ZONE_STRING = /%.*$/;
|
||||
exports2.RE_URL = /^\[{0,1}([0-9a-f:]+)\]{0,1}/;
|
||||
exports2.RE_URL_WITH_PORT = /\[([0-9a-f:]+)\]:([0-9]{1,5})/;
|
||||
exports2.RE_URL = /^(?:\[([0-9a-f:.]+)\]|([0-9a-f:.]+))(?:[/?#].*)?$/i;
|
||||
exports2.RE_URL_WITH_PORT = /^\[([0-9a-f:.]+)\]:([0-9]{1,5})(?:[/?#].*)?$/i;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49465,6 +49476,7 @@ var require_ipv6 = __commonJS({
|
||||
this.v4 = false;
|
||||
this.zone = "";
|
||||
this.isInSubnet = common.isInSubnet;
|
||||
this.isHostInSubnet = common.isHostInSubnet;
|
||||
this.isCorrect = isCorrect6;
|
||||
if (optionalGroups === void 0) {
|
||||
this.groups = constants6.GROUPS;
|
||||
@@ -49481,7 +49493,8 @@ var require_ipv6 = __commonJS({
|
||||
throw new address_error_1.AddressError("Invalid subnet mask.");
|
||||
}
|
||||
address = address.replace(constants6.RE_SUBNET_STRING, "");
|
||||
} else if (/\//.test(address)) {
|
||||
}
|
||||
if (/\//.test(address)) {
|
||||
throw new address_error_1.AddressError("Invalid subnet mask.");
|
||||
}
|
||||
const zone = constants6.RE_ZONE_STRING.exec(address);
|
||||
@@ -49503,7 +49516,7 @@ var require_ipv6 = __commonJS({
|
||||
try {
|
||||
new _Address6(address);
|
||||
return true;
|
||||
} catch (e5) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -49518,7 +49531,7 @@ var require_ipv6 = __commonJS({
|
||||
* address.correctForm(); // '::e8:d4a5:1000'
|
||||
*/
|
||||
static fromBigInt(bigInt) {
|
||||
if (bigInt < 0n || bigInt > (1n << BigInt(constants6.BITS)) - 1n) {
|
||||
if (bigInt < BigInt(0) || bigInt > (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1)) {
|
||||
throw new address_error_1.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");
|
||||
}
|
||||
const hex = bigInt.toString(16).padStart(32, "0");
|
||||
@@ -49539,11 +49552,13 @@ var require_ipv6 = __commonJS({
|
||||
* addressAndPort.port; // 8080
|
||||
*/
|
||||
static fromURL(url) {
|
||||
var _a2;
|
||||
let host;
|
||||
let port = null;
|
||||
let result;
|
||||
if (url.indexOf("[") !== -1 && url.indexOf("]:") !== -1) {
|
||||
result = constants6.RE_URL_WITH_PORT.exec(url);
|
||||
const stripped = url.replace(/^[a-z][a-z0-9+.-]*:\/\//i, "");
|
||||
if (stripped.indexOf("[") !== -1 && stripped.indexOf("]:") !== -1) {
|
||||
result = constants6.RE_URL_WITH_PORT.exec(stripped);
|
||||
if (result === null) {
|
||||
return {
|
||||
error: "failed to parse address with port",
|
||||
@@ -49553,9 +49568,8 @@ var require_ipv6 = __commonJS({
|
||||
}
|
||||
host = result[1];
|
||||
port = result[2];
|
||||
} else if (url.indexOf("/") !== -1) {
|
||||
url = url.replace(/^[a-z0-9]+:\/\//, "");
|
||||
result = constants6.RE_URL.exec(url);
|
||||
} else {
|
||||
result = constants6.RE_URL.exec(stripped);
|
||||
if (result === null) {
|
||||
return {
|
||||
error: "failed to parse address from URL",
|
||||
@@ -49563,13 +49577,11 @@ var require_ipv6 = __commonJS({
|
||||
port: null
|
||||
};
|
||||
}
|
||||
host = result[1];
|
||||
} else {
|
||||
host = url;
|
||||
host = (_a2 = result[1]) !== null && _a2 !== void 0 ? _a2 : result[2];
|
||||
}
|
||||
if (port) {
|
||||
port = parseInt(port, 10);
|
||||
if (port < 0 || port > 65536) {
|
||||
if (port < 0 || port > 65535) {
|
||||
port = null;
|
||||
}
|
||||
} else {
|
||||
@@ -49831,7 +49843,7 @@ var require_ipv6 = __commonJS({
|
||||
getType() {
|
||||
for (let i5 = 0; i5 < TYPE_SUBNETS.length; i5++) {
|
||||
const entry = TYPE_SUBNETS[i5];
|
||||
if (this.isInSubnet(entry[0])) {
|
||||
if (this.isHostInSubnet(entry[0])) {
|
||||
return entry[1];
|
||||
}
|
||||
}
|
||||
@@ -49964,18 +49976,20 @@ var require_ipv6 = __commonJS({
|
||||
}
|
||||
const groups = address.split(":");
|
||||
const lastGroup = groups.slice(-1)[0];
|
||||
const v4Octets = lastGroup.split(".");
|
||||
if (v4Octets.length === constants4.GROUPS && v4Octets.every((octet) => /^\d{1,3}$/.test(octet))) {
|
||||
if (v4Octets.some((octet) => /^0\d/.test(octet))) {
|
||||
const highlighted = v4Octets.map(spanLeadingZeroes4).join(".");
|
||||
const prefix = groups.slice(0, -1).map(helpers.escapeHtml).join(":");
|
||||
const separator = groups.length > 1 ? ":" : "";
|
||||
throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.", `${prefix}${separator}${highlighted}`);
|
||||
}
|
||||
}
|
||||
const address4 = lastGroup.match(constants4.RE_ADDRESS);
|
||||
if (address4) {
|
||||
this.parsedAddress4 = address4[0];
|
||||
this.address4 = new ipv4_1.Address4(this.parsedAddress4);
|
||||
for (let i5 = 0; i5 < this.address4.groups; i5++) {
|
||||
if (/^0[0-9]+/.test(this.address4.parsedAddress[i5])) {
|
||||
const highlighted = this.address4.parsedAddress.map(spanLeadingZeroes4).join(".");
|
||||
const prefix = groups.slice(0, -1).map(helpers.escapeHtml).join(":");
|
||||
const separator = groups.length > 1 ? ":" : "";
|
||||
throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.", `${prefix}${separator}${highlighted}`);
|
||||
}
|
||||
}
|
||||
const v4Suffix = this.subnetMask >= 96 ? `/${this.subnetMask - 96}` : "";
|
||||
this.address4 = new ipv4_1.Address4(`${this.parsedAddress4}${v4Suffix}`);
|
||||
this.v4 = true;
|
||||
groups[groups.length - 1] = this.address4.toGroup6();
|
||||
address = groups.join(":");
|
||||
@@ -50059,7 +50073,11 @@ var require_ipv6 = __commonJS({
|
||||
return BigInt(`0x${this.parsedAddress.map(paddedHex).join("")}`);
|
||||
}
|
||||
/**
|
||||
* Return the last two groups of this address as an IPv4 address string
|
||||
* Return the last two groups of this address as an IPv4 address string.
|
||||
* If this address carries a CIDR prefix that covers the trailing 32 bits
|
||||
* (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the
|
||||
* corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to
|
||||
* `/32`.
|
||||
* @returns {Address4}
|
||||
* @example
|
||||
* var address = new Address6('2001:4860:4001::1825:bf11');
|
||||
@@ -50067,7 +50085,16 @@ var require_ipv6 = __commonJS({
|
||||
*/
|
||||
to4() {
|
||||
const binary = this.binaryZeroPad().split("");
|
||||
return ipv4_1.Address4.fromHex(BigInt(`0b${binary.slice(96, 128).join("")}`).toString(16).padStart(8, "0"));
|
||||
const hex = BigInt(`0b${binary.slice(96, 128).join("")}`).toString(16).padStart(8, "0");
|
||||
if (this.subnetMask >= 96) {
|
||||
const v4Mask = this.subnetMask - 96;
|
||||
const groups = [];
|
||||
for (let i5 = 0; i5 < 8; i5 += 2) {
|
||||
groups.push(parseInt(hex.slice(i5, i5 + 2), 16));
|
||||
}
|
||||
return new ipv4_1.Address4(`${groups.join(".")}/${v4Mask}`);
|
||||
}
|
||||
return ipv4_1.Address4.fromHex(hex);
|
||||
}
|
||||
/**
|
||||
* Return the v4-in-v6 form of the address
|
||||
@@ -50081,7 +50108,7 @@ var require_ipv6 = __commonJS({
|
||||
if (!/:$/.test(correct)) {
|
||||
infix = ":";
|
||||
}
|
||||
return correct + infix + address4.address;
|
||||
return correct + infix + address4.correctForm();
|
||||
}
|
||||
/**
|
||||
* Decodes the Teredo tunneling fields embedded in this address. Returns the
|
||||
@@ -50171,7 +50198,14 @@ var require_ipv6 = __commonJS({
|
||||
bits = prefixBits.slice(0, 96) + v4Bits;
|
||||
} else {
|
||||
const beforeU = 64 - pl;
|
||||
bits = prefixBits.slice(0, pl) + v4Bits.slice(0, beforeU) + "00000000" + v4Bits.slice(beforeU) + "0".repeat(128 - 72 - (32 - beforeU));
|
||||
bits = [
|
||||
prefixBits.slice(0, pl),
|
||||
v4Bits.slice(0, beforeU),
|
||||
// Bits 64 to 71 are the reserved u octet and are always zero.
|
||||
"00000000",
|
||||
v4Bits.slice(beforeU),
|
||||
"0".repeat(128 - 72 - (32 - beforeU))
|
||||
].join("");
|
||||
}
|
||||
const hex = BigInt(`0b${bits}`).toString(16).padStart(32, "0");
|
||||
const groups = [];
|
||||
@@ -50194,7 +50228,7 @@ var require_ipv6 = __commonJS({
|
||||
if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) {
|
||||
throw new address_error_1.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");
|
||||
}
|
||||
if (!this.isInSubnet(prefix6)) {
|
||||
if (!this.isHostInSubnet(prefix6)) {
|
||||
return null;
|
||||
}
|
||||
const bits = this.binaryZeroPad();
|
||||
@@ -50218,9 +50252,7 @@ var require_ipv6 = __commonJS({
|
||||
* @returns {Array}
|
||||
*/
|
||||
toByteArray() {
|
||||
const valueWithoutPadding = this.bigInt().toString(16);
|
||||
const leadingPad = "0".repeat(valueWithoutPadding.length % 2);
|
||||
const value = `${leadingPad}${valueWithoutPadding}`;
|
||||
const value = this.bigInt().toString(16).padStart(constants6.BITS / 4, "0");
|
||||
const bytes = [];
|
||||
for (let i5 = 0, length = value.length; i5 < length; i5 += 2) {
|
||||
bytes.push(parseInt(value.substring(i5, i5 + 2), 16));
|
||||
@@ -50239,19 +50271,28 @@ var require_ipv6 = __commonJS({
|
||||
/**
|
||||
* Convert a byte array to an Address6 object.
|
||||
*
|
||||
* Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an
|
||||
* `Int8Array` or a Java `byte[]` holds them), folding signed values to their
|
||||
* unsigned equivalent. Throws `AddressError` unless given exactly 16
|
||||
* integers from -128 to 255.
|
||||
*
|
||||
* To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`.
|
||||
* @returns {Address6}
|
||||
*/
|
||||
static fromByteArray(bytes) {
|
||||
common.assertByteArray(bytes, 16, "IPv6", -128);
|
||||
return this.fromUnsignedByteArray(bytes.map(unsignByte));
|
||||
}
|
||||
/**
|
||||
* Convert an unsigned byte array to an Address6 object.
|
||||
*
|
||||
* Throws `AddressError` unless given exactly 16 integers from 0 to 255.
|
||||
*
|
||||
* To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`.
|
||||
* @returns {Address6}
|
||||
*/
|
||||
static fromUnsignedByteArray(bytes) {
|
||||
common.assertByteArray(bytes, 16, "IPv6", 0);
|
||||
const BYTE_MAX = BigInt("256");
|
||||
let result = BigInt("0");
|
||||
let multiplier = BigInt("1");
|
||||
@@ -50273,6 +50314,10 @@ var require_ipv6 = __commonJS({
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isLinkLocal() {
|
||||
const embedded = this.embeddedIPv4();
|
||||
if (embedded) {
|
||||
return embedded.isLinkLocal();
|
||||
}
|
||||
if (this.getBitsBase2(0, 64) === "1111111010000000000000000000000000000000000000000000000000000000") {
|
||||
return true;
|
||||
}
|
||||
@@ -50283,6 +50328,10 @@ var require_ipv6 = __commonJS({
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMulticast() {
|
||||
const embedded = this.embeddedIPv4();
|
||||
if (embedded) {
|
||||
return embedded.isMulticast();
|
||||
}
|
||||
const type = this.getType();
|
||||
return type === "Multicast" || type.startsWith("Multicast ");
|
||||
}
|
||||
@@ -50305,27 +50354,54 @@ var require_ipv6 = __commonJS({
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMapped4() {
|
||||
return this.isInSubnet(IPV4_MAPPED_SUBNET);
|
||||
return this.isHostInSubnet(IPV4_MAPPED_SUBNET);
|
||||
}
|
||||
/**
|
||||
* If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped
|
||||
* (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`,
|
||||
* [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that
|
||||
* embedded address as an {@link Address4}; otherwise return null.
|
||||
*
|
||||
* The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`,
|
||||
* `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and
|
||||
* delegate to the embedded {@link Address4} when present, so a literal such as
|
||||
* `::ffff:127.0.0.1` is classified by what it actually reaches (loopback)
|
||||
* rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped).
|
||||
* This matters wherever the checks back a trust-boundary decision (e.g. an
|
||||
* SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`,
|
||||
* `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as
|
||||
* non-internal.
|
||||
* @returns {Address4 | null}
|
||||
*/
|
||||
embeddedIPv4() {
|
||||
if (this.isMapped4() || this.isHostInSubnet(NAT64_WELL_KNOWN_SUBNET)) {
|
||||
return this.to4();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is a Teredo address, false otherwise
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isTeredo() {
|
||||
return this.isInSubnet(TEREDO_SUBNET);
|
||||
return this.isHostInSubnet(TEREDO_SUBNET);
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is a 6to4 address, false otherwise
|
||||
* @returns {boolean}
|
||||
*/
|
||||
is6to4() {
|
||||
return this.isInSubnet(SIX_TO_FOUR_SUBNET);
|
||||
return this.isHostInSubnet(SIX_TO_FOUR_SUBNET);
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is a loopback address, false otherwise
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isLoopback() {
|
||||
const embedded = this.embeddedIPv4();
|
||||
if (embedded) {
|
||||
return embedded.isLoopback();
|
||||
}
|
||||
return this.getType() === "Loopback";
|
||||
}
|
||||
/**
|
||||
@@ -50333,13 +50409,64 @@ var require_ipv6 = __commonJS({
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isULA() {
|
||||
return this.isInSubnet(ULA_SUBNET);
|
||||
return this.isHostInSubnet(ULA_SUBNET);
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is private, i.e. a Unique Local Address in
|
||||
* `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)) or an
|
||||
* IPv4-mapped / NAT64 address whose embedded IPv4 address is in one of the
|
||||
* [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private ranges
|
||||
* (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to
|
||||
* {@link Address4.isPrivate}; use it instead of {@link isULA} when you need to
|
||||
* catch mapped RFC 1918 addresses as well as native ULAs.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isPrivate() {
|
||||
const embedded = this.embeddedIPv4();
|
||||
if (embedded) {
|
||||
return embedded.isPrivate();
|
||||
}
|
||||
return this.isULA();
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is an IPv4-mapped / NAT64 address whose embedded
|
||||
* IPv4 address is in the carrier-grade NAT range `100.64.0.0/10`
|
||||
* ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false
|
||||
* otherwise. There is no native IPv6 CGNAT range, so this only ever returns
|
||||
* true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`).
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isCGNAT() {
|
||||
const embedded = this.embeddedIPv4();
|
||||
if (embedded) {
|
||||
return embedded.isCGNAT();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is an IPv4-mapped / NAT64 address whose embedded
|
||||
* IPv4 address is the limited broadcast address `255.255.255.255`
|
||||
* ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise.
|
||||
* There is no IPv6 broadcast, so this only ever returns true for an embedded
|
||||
* IPv4 address (e.g. `::ffff:255.255.255.255`).
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isBroadcast() {
|
||||
const embedded = this.embeddedIPv4();
|
||||
if (embedded) {
|
||||
return embedded.isBroadcast();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is the unspecified address `::`.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isUnspecified() {
|
||||
const embedded = this.embeddedIPv4();
|
||||
if (embedded) {
|
||||
return embedded.isUnspecified();
|
||||
}
|
||||
return this.getType() === "Unspecified";
|
||||
}
|
||||
/**
|
||||
@@ -50347,7 +50474,7 @@ var require_ipv6 = __commonJS({
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isDocumentation() {
|
||||
return this.isInSubnet(DOCUMENTATION_SUBNET);
|
||||
return this.isHostInSubnet(DOCUMENTATION_SUBNET);
|
||||
}
|
||||
// #endregion
|
||||
// #region HTML
|
||||
@@ -50492,6 +50619,7 @@ var require_ipv6 = __commonJS({
|
||||
var ULA_SUBNET = new Address6("fc00::/7");
|
||||
var DOCUMENTATION_SUBNET = new Address6("2001:db8::/32");
|
||||
var IPV4_MAPPED_SUBNET = new Address6("::ffff:0:0/96");
|
||||
var NAT64_WELL_KNOWN_SUBNET = new Address6("64:ff9b::/96");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user