fix gitignore again

This commit is contained in:
olcxja 2026-05-10 16:36:35 +02:00
commit 5da5c2afe2
3329 changed files with 364540 additions and 3 deletions

View file

@ -0,0 +1,4 @@
export declare class AddressError extends Error {
parseMessage?: string;
constructor(message: string, parseMessage?: string);
}

12
electron/node_modules/ip-address/dist/address-error.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddressError = void 0;
class AddressError extends Error {
constructor(message, parseMessage) {
super(message);
this.name = 'AddressError';
this.parseMessage = parseMessage;
}
}
exports.AddressError = AddressError;
//# sourceMappingURL=address-error.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"address-error.js","sourceRoot":"","sources":["../src/address-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAa,SAAQ,KAAK;IAGrC,YAAY,OAAe,EAAE,YAAqB;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAE3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAVD,oCAUC","sourcesContent":["export class AddressError extends Error {\n parseMessage?: string;\n\n constructor(message: string, parseMessage?: string) {\n super(message);\n\n this.name = 'AddressError';\n\n this.parseMessage = parseMessage;\n }\n}\n"]}

20
electron/node_modules/ip-address/dist/common.d.ts generated vendored Normal file
View file

@ -0,0 +1,20 @@
import { Address4 } from './ipv4';
import { Address6 } from './ipv6';
export interface ReverseFormOptions {
omitSuffix?: boolean;
}
export declare function isInSubnet(this: Address4 | Address6, address: Address4 | Address6): boolean;
export declare function isCorrect(defaultBits: number): (this: Address4 | Address6) => boolean;
/**
* Returns the prefix length (number of leading 1 bits) of a contiguous
* subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g.
* `255.0.255.0`).
*/
export declare function prefixLengthFromMask(value: bigint, totalBits: number): number;
export declare function numberToPaddedHex(number: number): string;
export declare function stringToPaddedHex(numberString: string): string;
/**
* @param binaryValue Binary representation of a value (e.g. `10`)
* @param position Byte position, where 0 is the least significant bit
*/
export declare function testBit(binaryValue: string, position: number): boolean;

67
electron/node_modules/ip-address/dist/common.js generated vendored Normal file
View file

@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isInSubnet = isInSubnet;
exports.isCorrect = isCorrect;
exports.prefixLengthFromMask = prefixLengthFromMask;
exports.numberToPaddedHex = numberToPaddedHex;
exports.stringToPaddedHex = stringToPaddedHex;
exports.testBit = testBit;
const address_error_1 = require("./address-error");
function isInSubnet(address) {
if (this.subnetMask < address.subnetMask) {
return false;
}
if (this.mask(address.subnetMask) === address.mask()) {
return true;
}
return false;
}
function isCorrect(defaultBits) {
return function () {
if (this.addressMinusSuffix !== this.correctForm()) {
return false;
}
if (this.subnetMask === defaultBits && !this.parsedSubnet) {
return true;
}
return this.parsedSubnet === String(this.subnetMask);
};
}
/**
* Returns the prefix length (number of leading 1 bits) of a contiguous
* subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g.
* `255.0.255.0`).
*/
function prefixLengthFromMask(value, totalBits) {
const binary = value.toString(2).padStart(totalBits, '0');
if (binary.length > totalBits) {
throw new address_error_1.AddressError('Invalid subnet mask.');
}
const firstZero = binary.indexOf('0');
if (firstZero === -1) {
return totalBits;
}
if (binary.slice(firstZero).includes('1')) {
throw new address_error_1.AddressError('Invalid subnet mask.');
}
return firstZero;
}
function numberToPaddedHex(number) {
return number.toString(16).padStart(2, '0');
}
function stringToPaddedHex(numberString) {
return numberToPaddedHex(parseInt(numberString, 10));
}
/**
* @param binaryValue Binary representation of a value (e.g. `10`)
* @param position Byte position, where 0 is the least significant bit
*/
function testBit(binaryValue, position) {
const { length } = binaryValue;
if (position > length) {
return false;
}
const positionInString = length - position;
return binaryValue.substring(positionInString, positionInString + 1) === '1';
}
//# sourceMappingURL=common.js.map

1
electron/node_modules/ip-address/dist/common.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":";;AAQA,gCAUC;AAED,8BAYC;AAOD,oDAkBC;AAED,8CAEC;AAED,8CAEC;AAMD,0BASC;AA9ED,mDAA+C;AAM/C,SAAgB,UAAU,CAA4B,OAA4B;IAChF,IAAI,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,SAAS,CAAC,WAAmB;IAC3C,OAAO;QACL,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACnD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1D,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,KAAK,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,KAAa,EAAE,SAAiB;IACnE,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAE1D,IAAI,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,4BAAY,CAAC,sBAAsB,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,4BAAY,CAAC,sBAAsB,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,iBAAiB,CAAC,MAAc;IAC9C,OAAO,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,SAAgB,iBAAiB,CAAC,YAAoB;IACpD,OAAO,iBAAiB,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,WAAmB,EAAE,QAAgB;IAC3D,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;IAE/B,IAAI,QAAQ,GAAG,MAAM,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC3C,OAAO,WAAW,CAAC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC;AAC/E,CAAC","sourcesContent":["import { Address4 } from './ipv4';\nimport { Address6 } from './ipv6';\nimport { AddressError } from './address-error';\n\nexport interface ReverseFormOptions {\n omitSuffix?: boolean;\n}\n\nexport function isInSubnet(this: Address4 | Address6, address: Address4 | Address6) {\n if (this.subnetMask < address.subnetMask) {\n return false;\n }\n\n if (this.mask(address.subnetMask) === address.mask()) {\n return true;\n }\n\n return false;\n}\n\nexport function isCorrect(defaultBits: number) {\n return function (this: Address4 | Address6) {\n if (this.addressMinusSuffix !== this.correctForm()) {\n return false;\n }\n\n if (this.subnetMask === defaultBits && !this.parsedSubnet) {\n return true;\n }\n\n return this.parsedSubnet === String(this.subnetMask);\n };\n}\n\n/**\n * Returns the prefix length (number of leading 1 bits) of a contiguous\n * subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g.\n * `255.0.255.0`).\n */\nexport function prefixLengthFromMask(value: bigint, totalBits: number): number {\n const binary = value.toString(2).padStart(totalBits, '0');\n\n if (binary.length > totalBits) {\n throw new AddressError('Invalid subnet mask.');\n }\n\n const firstZero = binary.indexOf('0');\n\n if (firstZero === -1) {\n return totalBits;\n }\n\n if (binary.slice(firstZero).includes('1')) {\n throw new AddressError('Invalid subnet mask.');\n }\n\n return firstZero;\n}\n\nexport function numberToPaddedHex(number: number) {\n return number.toString(16).padStart(2, '0');\n}\n\nexport function stringToPaddedHex(numberString: string) {\n return numberToPaddedHex(parseInt(numberString, 10));\n}\n\n/**\n * @param binaryValue Binary representation of a value (e.g. `10`)\n * @param position Byte position, where 0 is the least significant bit\n */\nexport function testBit(binaryValue: string, position: number): boolean {\n const { length } = binaryValue;\n\n if (position > length) {\n return false;\n }\n\n const positionInString = length - position;\n return binaryValue.substring(positionInString, positionInString + 1) === '1';\n}\n"]}

View file

@ -0,0 +1,7 @@
export { Address4 } from './ipv4';
export { Address6 } from './ipv6';
export { AddressError } from './address-error';
import * as helpers from './v6/helpers';
export declare const v6: {
helpers: typeof helpers;
};

35
electron/node_modules/ip-address/dist/ip-address.js generated vendored Normal file
View file

@ -0,0 +1,35 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.v6 = exports.AddressError = exports.Address6 = exports.Address4 = void 0;
var ipv4_1 = require("./ipv4");
Object.defineProperty(exports, "Address4", { enumerable: true, get: function () { return ipv4_1.Address4; } });
var ipv6_1 = require("./ipv6");
Object.defineProperty(exports, "Address6", { enumerable: true, get: function () { return ipv6_1.Address6; } });
var address_error_1 = require("./address-error");
Object.defineProperty(exports, "AddressError", { enumerable: true, get: function () { return address_error_1.AddressError; } });
const helpers = __importStar(require("./v6/helpers"));
exports.v6 = { helpers };
//# sourceMappingURL=ip-address.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"ip-address.js","sourceRoot":"","sources":["../src/ip-address.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAkC;AAAzB,gGAAA,QAAQ,OAAA;AACjB,+BAAkC;AAAzB,gGAAA,QAAQ,OAAA;AACjB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAErB,sDAAwC;AAE3B,QAAA,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC","sourcesContent":["export { Address4 } from './ipv4';\nexport { Address6 } from './ipv6';\nexport { AddressError } from './address-error';\n\nimport * as helpers from './v6/helpers';\n\nexport const v6 = { helpers };\n"]}

267
electron/node_modules/ip-address/dist/ipv4.d.ts generated vendored Normal file
View file

@ -0,0 +1,267 @@
import * as common from './common';
/**
* Represents an IPv4 address
* @param {string} address - An IPv4 address string
*/
export declare class Address4 {
address: string;
addressMinusSuffix?: string;
groups: number;
parsedAddress: string[];
parsedSubnet: string;
subnet: string;
subnetMask: number;
v4: boolean;
private _binaryZeroPad?;
constructor(address: string);
/**
* Returns true if the given string is a valid IPv4 address (with optional
* CIDR subnet), false otherwise. Host bits in the subnet portion are
* allowed (e.g. `192.168.1.5/24` is valid); for strict network-address
* validation compare `correctForm()` to `startAddress().correctForm()`,
* or use `networkForm()`.
*/
static isValid(address: string): boolean;
/**
* Parses an IPv4 address string into its four octet groups and stores the
* result on `this.parsedAddress`. Called automatically by the constructor;
* you typically don't need to call it directly. Throws `AddressError` if
* the input is not a valid IPv4 address.
*/
parse(address: string): string[];
/**
* Returns the address in correct form: octets joined with `.` and any
* leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the
* canonical dotted-decimal representation.
*/
correctForm(): string;
/**
* Returns true if the address is correct, false otherwise
* @returns {Boolean}
*/
isCorrect: (this: Address4 | import("./ipv6").Address6) => boolean;
/**
* Construct an `Address4` from an address and a dotted-decimal subnet
* mask given as separate strings (e.g. as returned by Node's
* `os.networkInterfaces()`). Throws `AddressError` if the mask is
* non-contiguous (e.g. `255.0.255.0`).
* @example
* var address = Address4.fromAddressAndMask('192.168.1.1', '255.255.255.0');
* address.subnetMask; // 24
*/
static fromAddressAndMask(address: string, mask: string): Address4;
/**
* Construct an `Address4` from an address and a Cisco-style wildcard mask
* given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard
* mask is the bitwise inverse of the subnet mask. Throws `AddressError`
* if the mask is non-contiguous (e.g. `0.255.0.255`).
* @example
* var address = Address4.fromAddressAndWildcardMask('10.0.0.1', '0.0.0.255');
* address.subnetMask; // 24
*/
static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address4;
/**
* Construct an `Address4` from a wildcard pattern with trailing `*`
* octets. The number of trailing wildcards determines the prefix
* length: each `*` represents 8 bits.
*
* Only trailing whole-octet wildcards are supported. Partial-octet
* wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g.
* `192.*.0.1`) throw `AddressError`.
* @example
* Address4.fromWildcard('192.168.0.*').subnet; // '/24'
* Address4.fromWildcard('192.168.*.*').subnet; // '/16'
* Address4.fromWildcard('*.*.*.*').subnet; // '/0'
*/
static fromWildcard(input: string): Address4;
/**
* Converts a hex string to an IPv4 address object. Accepts 8 hex digits
* with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`).
* Throws `AddressError` for any other length or for non-hex characters.
* @param {string} hex - a hex string to convert
* @returns {Address4}
*/
static fromHex(hex: string): Address4;
/**
* Converts an integer into a IPv4 address object. The integer must be a
* non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise
* `AddressError` is thrown.
* @param {integer} integer - a number to convert
* @returns {Address4}
*/
static fromInteger(integer: number): Address4;
/**
* Return an address from in-addr.arpa form
* @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address
* @returns {Adress4}
* @example
* var address = Address4.fromArpa(42.2.0.192.in-addr.arpa.)
* address.correctForm(); // '192.0.2.42'
*/
static fromArpa(arpaFormAddress: string): Address4;
/**
* Converts an IPv4 address object to a hex string
* @returns {String}
*/
toHex(): string;
/**
* Converts an IPv4 address object to an array of bytes.
*
* To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`.
* @returns {Array}
*/
toArray(): number[];
/**
* Converts an IPv4 address object to an IPv6 address group
* @returns {String}
*/
toGroup6(): string;
/**
* Returns the address as a `bigint`
* @returns {bigint}
*/
bigInt(): bigint;
/**
* Helper function getting start address.
* @returns {bigint}
*/
_startAddress(): bigint;
/**
* The first address in the range given by this address' subnet.
* Often referred to as the Network Address.
* @returns {Address4}
*/
startAddress(): Address4;
/**
* The first host address in the range given by this address's subnet ie
* the first address after the Network Address
* @returns {Address4}
*/
startAddressExclusive(): Address4;
/**
* Helper function getting end address.
* @returns {bigint}
*/
_endAddress(): bigint;
/**
* The last address in the range given by this address' subnet
* Often referred to as the Broadcast
* @returns {Address4}
*/
endAddress(): Address4;
/**
* The last host address in the range given by this address's subnet ie
* the last address prior to the Broadcast Address
* @returns {Address4}
*/
endAddressExclusive(): Address4;
/**
* The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for
* a `/20`. Returns an `Address4`; call `.correctForm()` for the string.
* @returns {Address4}
*/
subnetMaskAddress(): Address4;
/**
* The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is
* the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`;
* call `.correctForm()` for the string.
* @returns {Address4}
*/
wildcardMask(): Address4;
/**
* The network address in CIDR string form, e.g. `192.168.1.0/24` for
* `192.168.1.5/24`. For an address with no explicit subnet the prefix is
* `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`.
* @returns {string}
*/
networkForm(): string;
/**
* Converts a BigInt to a v4 address object. The value must be in the
* range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown.
* @param {bigint} bigInt - a BigInt to convert
* @returns {Address4}
*/
static fromBigInt(bigInt: bigint): Address4;
/**
* Convert a byte array to an Address4 object.
*
* To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`.
* @param {Array<number>} bytes - an array of 4 bytes (0-255)
* @returns {Address4}
*/
static fromByteArray(bytes: Array<number>): Address4;
/**
* Convert an unsigned byte array to an Address4 object
* @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255)
* @returns {Address4}
*/
static fromUnsignedByteArray(bytes: Array<number>): Address4;
/**
* Returns the first n bits of the address, defaulting to the
* subnet mask
* @returns {String}
*/
mask(mask?: number): string;
/**
* Returns the bits in the given range as a base-2 string
* @returns {string}
*/
getBitsBase2(start: number, end: number): string;
/**
* Return the reversed ip6.arpa form of the address
* @param {Object} options
* @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
* @returns {String}
*/
reverseForm(options?: common.ReverseFormOptions): string;
/**
* Returns true if the given address is in the subnet of the current address
* @returns {boolean}
*/
isInSubnet: typeof common.isInSubnet;
/**
* Returns true if the given address is a multicast address
* @returns {boolean}
*/
isMulticast(): boolean;
/**
* 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(): boolean;
/**
* 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(): boolean;
/**
* 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(): boolean;
/**
* Returns true if the address is the unspecified address `0.0.0.0`.
* @returns {boolean}
*/
isUnspecified(): boolean;
/**
* 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(): boolean;
/**
* 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(): boolean;
/**
* Returns a zero-padded base-2 string representation of the address
* @returns {string}
*/
binaryZeroPad(): string;
/**
* Groups an IPv4 address for inclusion at the end of an IPv6 address
* @returns {String}
*/
groupForV6(): string;
}

485
electron/node_modules/ip-address/dist/ipv4.js generated vendored Normal file
View file

@ -0,0 +1,485 @@
"use strict";
/* eslint-disable no-param-reassign */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Address4 = void 0;
const common = __importStar(require("./common"));
const constants = __importStar(require("./v4/constants"));
const address_error_1 = require("./address-error");
const isCorrect4 = common.isCorrect(constants.BITS);
/**
* Represents an IPv4 address
* @param {string} address - An IPv4 address string
*/
class Address4 {
constructor(address) {
this.groups = constants.GROUPS;
this.parsedAddress = [];
this.parsedSubnet = '';
this.subnet = '/32';
this.subnetMask = 32;
this.v4 = true;
/**
* Returns true if the address is correct, false otherwise
* @returns {Boolean}
*/
this.isCorrect = isCorrect4;
/**
* Returns true if the given address is in the subnet of the current address
* @returns {boolean}
*/
this.isInSubnet = common.isInSubnet;
this.address = address;
const subnet = constants.RE_SUBNET_STRING.exec(address);
if (subnet) {
this.parsedSubnet = subnet[0].replace('/', '');
this.subnetMask = parseInt(this.parsedSubnet, 10);
this.subnet = `/${this.subnetMask}`;
if (this.subnetMask < 0 || this.subnetMask > constants.BITS) {
throw new address_error_1.AddressError('Invalid subnet mask.');
}
address = address.replace(constants.RE_SUBNET_STRING, '');
}
this.addressMinusSuffix = address;
this.parsedAddress = this.parse(address);
}
/**
* Returns true if the given string is a valid IPv4 address (with optional
* CIDR subnet), false otherwise. Host bits in the subnet portion are
* allowed (e.g. `192.168.1.5/24` is valid); for strict network-address
* validation compare `correctForm()` to `startAddress().correctForm()`,
* or use `networkForm()`.
*/
static isValid(address) {
try {
// eslint-disable-next-line no-new
new Address4(address);
return true;
}
catch (e) {
return false;
}
}
/**
* Parses an IPv4 address string into its four octet groups and stores the
* result on `this.parsedAddress`. Called automatically by the constructor;
* you typically don't need to call it directly. Throws `AddressError` if
* the input is not a valid IPv4 address.
*/
parse(address) {
const groups = address.split('.');
if (!address.match(constants.RE_ADDRESS)) {
throw new address_error_1.AddressError('Invalid IPv4 address.');
}
return groups;
}
/**
* Returns the address in correct form: octets joined with `.` and any
* leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the
* canonical dotted-decimal representation.
*/
correctForm() {
return this.parsedAddress.map((part) => parseInt(part, 10)).join('.');
}
/**
* Construct an `Address4` from an address and a dotted-decimal subnet
* mask given as separate strings (e.g. as returned by Node's
* `os.networkInterfaces()`). Throws `AddressError` if the mask is
* non-contiguous (e.g. `255.0.255.0`).
* @example
* var address = Address4.fromAddressAndMask('192.168.1.1', '255.255.255.0');
* address.subnetMask; // 24
*/
static fromAddressAndMask(address, mask) {
const bits = common.prefixLengthFromMask(new Address4(mask).bigInt(), constants.BITS);
return new Address4(`${address}/${bits}`);
}
/**
* Construct an `Address4` from an address and a Cisco-style wildcard mask
* given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard
* mask is the bitwise inverse of the subnet mask. Throws `AddressError`
* if the mask is non-contiguous (e.g. `0.255.0.255`).
* @example
* var address = Address4.fromAddressAndWildcardMask('10.0.0.1', '0.0.0.255');
* address.subnetMask; // 24
*/
static fromAddressAndWildcardMask(address, wildcardMask) {
const wildcard = new Address4(wildcardMask).bigInt();
const allOnes = (BigInt(1) << BigInt(constants.BITS)) - BigInt(1);
// eslint-disable-next-line no-bitwise
const mask = wildcard ^ allOnes;
const bits = common.prefixLengthFromMask(mask, constants.BITS);
return new Address4(`${address}/${bits}`);
}
/**
* Construct an `Address4` from a wildcard pattern with trailing `*`
* octets. The number of trailing wildcards determines the prefix
* length: each `*` represents 8 bits.
*
* Only trailing whole-octet wildcards are supported. Partial-octet
* wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g.
* `192.*.0.1`) throw `AddressError`.
* @example
* Address4.fromWildcard('192.168.0.*').subnet; // '/24'
* Address4.fromWildcard('192.168.*.*').subnet; // '/16'
* Address4.fromWildcard('*.*.*.*').subnet; // '/0'
*/
static fromWildcard(input) {
const groups = input.split('.');
if (groups.length !== constants.GROUPS) {
throw new address_error_1.AddressError('Wildcard pattern must have 4 octets');
}
let firstWildcard = -1;
for (let i = 0; i < groups.length; i++) {
if (groups[i] === '*') {
if (firstWildcard === -1) {
firstWildcard = i;
}
}
else if (firstWildcard !== -1) {
throw new address_error_1.AddressError('Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)');
}
}
const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard;
const replaced = groups.map((g) => (g === '*' ? '0' : g));
const subnetBits = constants.BITS - trailing * 8;
return new Address4(`${replaced.join('.')}/${subnetBits}`);
}
/**
* Converts a hex string to an IPv4 address object. Accepts 8 hex digits
* with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`).
* Throws `AddressError` for any other length or for non-hex characters.
* @param {string} hex - a hex string to convert
* @returns {Address4}
*/
static fromHex(hex) {
const stripped = hex.replace(/:/g, '');
if (!/^[0-9a-fA-F]{8}$/.test(stripped)) {
throw new address_error_1.AddressError('IPv4 hex must be exactly 8 hex digits');
}
const groups = [];
for (let i = 0; i < 8; i += 2) {
groups.push(parseInt(stripped.slice(i, i + 2), 16));
}
return new Address4(groups.join('.'));
}
/**
* Converts an integer into a IPv4 address object. The integer must be a
* non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise
* `AddressError` is thrown.
* @param {integer} integer - a number to convert
* @returns {Address4}
*/
static fromInteger(integer) {
if (!Number.isInteger(integer) || integer < 0 || integer > 0xffffffff) {
throw new address_error_1.AddressError('IPv4 integer must be in the range 0 to 2**32 - 1');
}
return Address4.fromHex(integer.toString(16).padStart(8, '0'));
}
/**
* Return an address from in-addr.arpa form
* @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address
* @returns {Adress4}
* @example
* var address = Address4.fromArpa(42.2.0.192.in-addr.arpa.)
* address.correctForm(); // '192.0.2.42'
*/
static fromArpa(arpaFormAddress) {
// remove ending ".in-addr.arpa." or just "."
const leader = arpaFormAddress.replace(/(\.in-addr\.arpa)?\.$/, '');
const address = leader.split('.').reverse().join('.');
return new Address4(address);
}
/**
* Converts an IPv4 address object to a hex string
* @returns {String}
*/
toHex() {
return this.parsedAddress.map((part) => common.stringToPaddedHex(part)).join(':');
}
/**
* Converts an IPv4 address object to an array of bytes.
*
* To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`.
* @returns {Array}
*/
toArray() {
return this.parsedAddress.map((part) => parseInt(part, 10));
}
/**
* Converts an IPv4 address object to an IPv6 address group
* @returns {String}
*/
toGroup6() {
const output = [];
let i;
for (i = 0; i < constants.GROUPS; i += 2) {
output.push(`${common.stringToPaddedHex(this.parsedAddress[i])}${common.stringToPaddedHex(this.parsedAddress[i + 1])}`);
}
return output.join(':');
}
/**
* Returns the address as a `bigint`
* @returns {bigint}
*/
bigInt() {
return BigInt(`0x${this.parsedAddress.map((n) => common.stringToPaddedHex(n)).join('')}`);
}
/**
* Helper function getting start address.
* @returns {bigint}
*/
_startAddress() {
return BigInt(`0b${this.mask() + '0'.repeat(constants.BITS - this.subnetMask)}`);
}
/**
* The first address in the range given by this address' subnet.
* Often referred to as the Network Address.
* @returns {Address4}
*/
startAddress() {
return Address4.fromBigInt(this._startAddress());
}
/**
* The first host address in the range given by this address's subnet ie
* the first address after the Network Address
* @returns {Address4}
*/
startAddressExclusive() {
const adjust = BigInt('1');
return Address4.fromBigInt(this._startAddress() + adjust);
}
/**
* Helper function getting end address.
* @returns {bigint}
*/
_endAddress() {
return BigInt(`0b${this.mask() + '1'.repeat(constants.BITS - this.subnetMask)}`);
}
/**
* The last address in the range given by this address' subnet
* Often referred to as the Broadcast
* @returns {Address4}
*/
endAddress() {
return Address4.fromBigInt(this._endAddress());
}
/**
* The last host address in the range given by this address's subnet ie
* the last address prior to the Broadcast Address
* @returns {Address4}
*/
endAddressExclusive() {
const adjust = BigInt('1');
return Address4.fromBigInt(this._endAddress() - adjust);
}
/**
* The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for
* a `/20`. Returns an `Address4`; call `.correctForm()` for the string.
* @returns {Address4}
*/
subnetMaskAddress() {
return Address4.fromBigInt(BigInt(`0b${'1'.repeat(this.subnetMask)}${'0'.repeat(constants.BITS - this.subnetMask)}`));
}
/**
* The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is
* the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`;
* call `.correctForm()` for the string.
* @returns {Address4}
*/
wildcardMask() {
return Address4.fromBigInt(BigInt(`0b${'0'.repeat(this.subnetMask)}${'1'.repeat(constants.BITS - this.subnetMask)}`));
}
/**
* The network address in CIDR string form, e.g. `192.168.1.0/24` for
* `192.168.1.5/24`. For an address with no explicit subnet the prefix is
* `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`.
* @returns {string}
*/
networkForm() {
return `${this.startAddress().correctForm()}/${this.subnetMask}`;
}
/**
* Converts a BigInt to a v4 address object. The value must be in the
* range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown.
* @param {bigint} bigInt - a BigInt to convert
* @returns {Address4}
*/
static fromBigInt(bigInt) {
if (bigInt < 0n || bigInt > 0xffffffffn) {
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'));
}
/**
* Convert a byte array to an Address4 object.
*
* To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`.
* @param {Array<number>} bytes - an array of 4 bytes (0-255)
* @returns {Address4}
*/
static fromByteArray(bytes) {
if (bytes.length !== 4) {
throw new address_error_1.AddressError('IPv4 addresses require exactly 4 bytes');
}
// Validate that all bytes are within valid range (0-255)
for (let i = 0; i < bytes.length; i++) {
if (!Number.isInteger(bytes[i]) || bytes[i] < 0 || bytes[i] > 255) {
throw new address_error_1.AddressError('All bytes must be integers between 0 and 255');
}
}
return this.fromUnsignedByteArray(bytes);
}
/**
* Convert an unsigned byte array to an Address4 object
* @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255)
* @returns {Address4}
*/
static fromUnsignedByteArray(bytes) {
if (bytes.length !== 4) {
throw new address_error_1.AddressError('IPv4 addresses require exactly 4 bytes');
}
const address = bytes.join('.');
return new Address4(address);
}
/**
* Returns the first n bits of the address, defaulting to the
* subnet mask
* @returns {String}
*/
mask(mask) {
if (mask === undefined) {
mask = this.subnetMask;
}
return this.getBitsBase2(0, mask);
}
/**
* Returns the bits in the given range as a base-2 string
* @returns {string}
*/
getBitsBase2(start, end) {
return this.binaryZeroPad().slice(start, end);
}
/**
* Return the reversed ip6.arpa form of the address
* @param {Object} options
* @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
* @returns {String}
*/
reverseForm(options) {
if (!options) {
options = {};
}
const reversed = this.correctForm().split('.').reverse().join('.');
if (options.omitSuffix) {
return reversed;
}
return `${reversed}.in-addr.arpa.`;
}
/**
* Returns true if the given address is a multicast address
* @returns {boolean}
*/
isMulticast() {
return this.isInSubnet(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));
}
/**
* 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);
}
/**
* 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);
}
/**
* Returns true if the address is the unspecified address `0.0.0.0`.
* @returns {boolean}
*/
isUnspecified() {
return this.isInSubnet(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);
}
/**
* 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);
}
/**
* Returns a zero-padded base-2 string representation of the address
* @returns {string}
*/
binaryZeroPad() {
if (this._binaryZeroPad === undefined) {
this._binaryZeroPad = this.bigInt().toString(2).padStart(constants.BITS, '0');
}
return this._binaryZeroPad;
}
/**
* Groups an IPv4 address for inclusion at the end of an IPv6 address
* @returns {String}
*/
groupForV6() {
const segments = this.parsedAddress;
return this.address.replace(constants.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>`);
}
}
exports.Address4 = Address4;
const MULTICAST_V4 = new Address4('224.0.0.0/4');
const PRIVATE_V4 = [
new Address4('10.0.0.0/8'),
new Address4('172.16.0.0/12'),
new Address4('192.168.0.0/16'),
];
const LOOPBACK_V4 = new Address4('127.0.0.0/8');
const LINK_LOCAL_V4 = new Address4('169.254.0.0/16');
const UNSPECIFIED_V4 = new Address4('0.0.0.0/32');
const BROADCAST_V4 = new Address4('255.255.255.255/32');
const CGNAT_V4 = new Address4('100.64.0.0/10');
//# sourceMappingURL=ipv4.js.map

1
electron/node_modules/ip-address/dist/ipv4.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

489
electron/node_modules/ip-address/dist/ipv6.d.ts generated vendored Normal file
View file

@ -0,0 +1,489 @@
import * as common from './common';
import { Address4 } from './ipv4';
interface SixToFourProperties {
prefix: string;
gateway: string;
}
interface TeredoProperties {
prefix: string;
server4: string;
client4: string;
flags: string;
coneNat: boolean;
microsoft: {
reserved: boolean;
universalLocal: boolean;
groupIndividual: boolean;
nonce: string;
};
udpPort: string;
}
/**
* Represents an IPv6 address
* @param {string} address - An IPv6 address string
* @param {number} [groups=8] - How many octets to parse
* @example
* var address = new Address6('2001::/32');
*/
export declare class Address6 {
address4?: Address4;
address: string;
addressMinusSuffix: string;
elidedGroups?: number;
elisionBegin?: number;
elisionEnd?: number;
groups: number;
parsedAddress4?: string;
parsedAddress: string[];
parsedSubnet: string;
subnet: string;
subnetMask: number;
v4: boolean;
zone: string;
private _binaryZeroPad?;
constructor(address: string, optionalGroups?: number);
/**
* Returns true if the given string is a valid IPv6 address (with optional
* CIDR subnet and zone identifier), false otherwise. Host bits in the
* subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict
* network-address validation compare `correctForm()` to
* `startAddress().correctForm()`, or use `networkForm()`.
*/
static isValid(address: string): boolean;
/**
* Convert a BigInt to a v6 address object. The value must be in the
* range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown.
* @param {bigint} bigInt - a BigInt to convert
* @returns {Address6}
* @example
* var bigInt = BigInt('1000000000000');
* var address = Address6.fromBigInt(bigInt);
* address.correctForm(); // '::e8:d4a5:1000'
*/
static fromBigInt(bigInt: bigint): Address6;
/**
* Parse a URL (with optional bracketed host and port) into an address and
* port. Returns either `{ address, port }` on success or
* `{ error, address: null, port: null }` if the URL could not be parsed.
* Ports are returned as numbers (or `null` if absent or out of range).
* @example
* var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/');
* addressAndPort.address.correctForm(); // 'ffff::'
* addressAndPort.port; // 8080
*/
static fromURL(url: string): {
error: string;
address: null;
port: null;
} | {
address: Address6;
port: number | null;
error?: undefined;
};
/**
* Construct an `Address6` from an address and a hex subnet mask given as
* separate strings (e.g. as returned by Node's `os.networkInterfaces()`).
* Throws `AddressError` if the mask is non-contiguous (e.g.
* `ffff::ffff`).
* @example
* var address = Address6.fromAddressAndMask('fe80::1', 'ffff:ffff:ffff:ffff::');
* address.subnetMask; // 64
*/
static fromAddressAndMask(address: string, mask: string): Address6;
/**
* Construct an `Address6` from an address and a Cisco-style wildcard mask
* given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`).
* The wildcard mask is the bitwise inverse of the subnet mask. Throws
* `AddressError` if the mask is non-contiguous.
* @example
* var address = Address6.fromAddressAndWildcardMask('fe80::1', '::ffff:ffff:ffff:ffff');
* address.subnetMask; // 64
*/
static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address6;
/**
* Construct an `Address6` from a wildcard pattern with trailing `*`
* groups. The number of trailing wildcards determines the prefix
* length: each `*` represents 16 bits. `::` is expanded to zero groups
* (not wildcards) before evaluating trailing wildcards.
*
* Only trailing whole-group wildcards are supported. Partial-group
* wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g.
* `*::1`) throw `AddressError`.
* @example
* Address6.fromWildcard('2001:db8:*:*:*:*:*:*').subnet; // '/32'
* Address6.fromWildcard('2001:db8::*').subnet; // '/112'
* Address6.fromWildcard('*:*:*:*:*:*:*:*').subnet; // '/0'
*/
static fromWildcard(input: string): Address6;
/**
* Create an IPv6-mapped address given an IPv4 address
* @param {string} address - An IPv4 address string
* @returns {Address6}
* @example
* var address = Address6.fromAddress4('192.168.0.1');
* address.correctForm(); // '::ffff:c0a8:1'
* address.to4in6(); // '::ffff:192.168.0.1'
*/
static fromAddress4(address: string): Address6;
/**
* Return an address from ip6.arpa form
* @param {string} arpaFormAddress - an 'ip6.arpa' form address
* @returns {Adress6}
* @example
* var address = Address6.fromArpa(e.f.f.f.3.c.2.6.f.f.f.e.6.6.8.e.1.0.6.7.9.4.e.c.0.0.0.0.1.0.0.2.ip6.arpa.)
* address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe'
*/
static fromArpa(arpaFormAddress: string): Address6;
/**
* Return the Microsoft UNC transcription of the address
* @returns {String} the Microsoft UNC transcription of the address
*/
microsoftTranscription(): string;
/**
* Return the first n bits of the address, defaulting to the subnet mask
* @param {number} [mask=subnet] - the number of bits to mask
* @returns {String} the first n bits of the address as a string
*/
mask(mask?: number): string;
/**
* Return the number of possible subnets of a given size in the address
* @param {number} [subnetSize=128] - the subnet size
* @returns {String}
*/
possibleSubnets(subnetSize?: number): string;
/**
* Helper function getting start address.
* @returns {bigint}
*/
_startAddress(): bigint;
/**
* The first address in the range given by this address' subnet
* Often referred to as the Network Address.
* @returns {Address6}
*/
startAddress(): Address6;
/**
* The first host address in the range given by this address's subnet ie
* the first address after the Network Address
* @returns {Address6}
*/
startAddressExclusive(): Address6;
/**
* Helper function getting end address.
* @returns {bigint}
*/
_endAddress(): bigint;
/**
* The last address in the range given by this address' subnet
* Often referred to as the Broadcast
* @returns {Address6}
*/
endAddress(): Address6;
/**
* The last host address in the range given by this address's subnet ie
* the last address prior to the Broadcast Address
* @returns {Address6}
*/
endAddressExclusive(): Address6;
/**
* The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a
* `/64`. Returns an `Address6`; call `.correctForm()` for the string.
* @returns {Address6}
*/
subnetMaskAddress(): Address6;
/**
* The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a
* `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns
* an `Address6`; call `.correctForm()` for the string.
* @returns {Address6}
*/
wildcardMask(): Address6;
/**
* The network address in CIDR string form, e.g. `2001:db8::/32` for
* `2001:db8::1/32`. For an address with no explicit subnet the prefix
* is `/128`, e.g. `networkForm()` on `2001:db8::1` returns
* `2001:db8::1/128`.
* @returns {string}
*/
networkForm(): string;
/**
* Return the scope of the address. The 4-bit scope field
* ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7))
* is only defined for multicast addresses; for unicast addresses the scope
* is derived from the address type per
* [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6).
* @returns {String}
*/
getScope(): string;
/**
* Return the type of the address
* @returns {String}
*/
getType(): string;
/**
* Return the bits in the given range as a BigInt
* @returns {bigint}
*/
getBits(start: number, end: number): bigint;
/**
* Return the bits in the given range as a base-2 string
* @returns {String}
*/
getBitsBase2(start: number, end: number): string;
/**
* Return the bits in the given range as a base-16 string
* @returns {String}
*/
getBitsBase16(start: number, end: number): string;
/**
* Return the bits that are set past the subnet mask length
* @returns {String}
*/
getBitsPastSubnet(): string;
/**
* Return the reversed ip6.arpa form of the address
* @param {Object} options
* @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix
* @returns {String}
*/
reverseForm(options?: common.ReverseFormOptions): string;
/**
* Returns the address in correct form, per
* [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros
* stripped, the longest run of zero groups collapsed to `::`, and hex digits
* lowercased (e.g. `2001:db8::1`). This is the recommended form for display.
*/
correctForm(): string;
/**
* Return a zero-padded base-2 string representation of the address
* @returns {String}
* @example
* var address = new Address6('2001:4860:4001:803::1011');
* address.binaryZeroPad();
* // '0010000000000001010010000110000001000000000000010000100000000011
* // 0000000000000000000000000000000000000000000000000001000000010001'
*/
binaryZeroPad(): string;
/**
* Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the
* trailing IPv4 address into `this.address4` / `this.parsedAddress4` and
* returning the address with the v4 portion converted to two v6 groups.
* Used internally by `parse()`.
*/
parse4in6(address: string): string;
/**
* Parses an IPv6 address string into its 8 hexadecimal groups (expanding
* any `::` elision and any trailing v4-in-v6 portion) and stores the result
* on `this.parsedAddress`. Called automatically by the constructor; you
* typically don't need to call it directly. Throws `AddressError` if the
* input is malformed.
*/
parse(address: string): string[];
/**
* Returns the canonical (fully expanded) form of the address: all 8 groups,
* each padded to 4 hex digits, with no `::` collapsing
* (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and
* byte-exact comparison.
*/
canonicalForm(): string;
/**
* Return the decimal form of the address
* @returns {String}
*/
decimal(): string;
/**
* Return the address as a BigInt
* @returns {bigint}
*/
bigInt(): bigint;
/**
* Return the last two groups of this address as an IPv4 address string
* @returns {Address4}
* @example
* var address = new Address6('2001:4860:4001::1825:bf11');
* address.to4().correctForm(); // '24.37.191.17'
*/
to4(): Address4;
/**
* Return the v4-in-v6 form of the address
* @returns {String}
*/
to4in6(): string;
/**
* Decodes the Teredo tunneling fields embedded in this address. Returns the
* Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag,
* UDP port, and Microsoft-format flag breakdown (reserved, universal/local,
* group/individual, nonce). Only meaningful for addresses in `2001::/32`.
*/
inspectTeredo(): TeredoProperties;
/**
* Decodes the 6to4 tunneling fields embedded in this address. Returns the
* 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for
* addresses in `2002::/16`.
*/
inspect6to4(): SixToFourProperties;
/**
* Return a v6 6to4 address from a v6 v4inv6 address
* @returns {Address6}
*/
to6to4(): Address6 | null;
/**
* Embed an IPv4 address into a NAT64 IPv6 address using the encoding
* defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
* The default prefix is the well-known prefix `64:ff9b::/96`. The prefix
* length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter
* than /64 the IPv4 octets are split around the reserved bits 6471.
* @example
* Address6.fromAddress4Nat64('192.0.2.33').correctForm(); // '64:ff9b::c000:221'
* Address6.fromAddress4Nat64('192.0.2.33', '2001:db8::/32').correctForm(); // '2001:db8:c000:221::'
*/
static fromAddress4Nat64(address: string, prefix?: string): Address6;
/**
* Extract the embedded IPv4 address from a NAT64 IPv6 address using the
* encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
* The default prefix is the well-known prefix `64:ff9b::/96`. Returns
* `null` if this address is not contained within the given prefix.
* @example
* new Address6('64:ff9b::c000:221').toAddress4Nat64()!.correctForm(); // '192.0.2.33'
*/
toAddress4Nat64(prefix?: string): Address4 | null;
/**
* Return a byte array.
*
* To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`.
* @returns {Array}
*/
toByteArray(): number[];
/**
* Return an unsigned byte array.
*
* To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`.
* @returns {Array}
*/
toUnsignedByteArray(): number[];
/**
* Convert a byte array to an Address6 object.
*
* To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`.
* @returns {Address6}
*/
static fromByteArray(bytes: Array<any>): Address6;
/**
* Convert an unsigned byte array to an Address6 object.
*
* To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`.
* @returns {Address6}
*/
static fromUnsignedByteArray(bytes: Array<any>): Address6;
/**
* Returns true if the given address is in the subnet of the current address
* @returns {boolean}
*/
isInSubnet: typeof common.isInSubnet;
/**
* Returns true if the address is correct, false otherwise
* @returns {boolean}
*/
isCorrect: (this: Address4 | Address6) => boolean;
/**
* Returns true if the address is in the canonical form, false otherwise
* @returns {boolean}
*/
isCanonical(): boolean;
/**
* Returns true if the address is a link local address, false otherwise
* @returns {boolean}
*/
isLinkLocal(): boolean;
/**
* Returns true if the address is a multicast address, false otherwise
* @returns {boolean}
*/
isMulticast(): boolean;
/**
* Returns true if the address was written in v4-in-v6 dotted-quad notation
* (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag
* and does not reflect whether the address bits lie in the IPv4-mapped
* (`::ffff:0:0/96`) subnet for that, see {@link isMapped4}.
* @returns {boolean}
*/
is4(): boolean;
/**
* Returns true if the address is an IPv4-mapped IPv6 address in
* `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)),
* false otherwise. Unlike {@link is4}, this checks the underlying address
* bits rather than the textual notation, so `::ffff:127.0.0.1` and
* `::ffff:7f00:1` both return true.
* @returns {boolean}
*/
isMapped4(): boolean;
/**
* Returns true if the address is a Teredo address, false otherwise
* @returns {boolean}
*/
isTeredo(): boolean;
/**
* Returns true if the address is a 6to4 address, false otherwise
* @returns {boolean}
*/
is6to4(): boolean;
/**
* Returns true if the address is a loopback address, false otherwise
* @returns {boolean}
*/
isLoopback(): boolean;
/**
* Returns true if the address is a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)). ULAs are the IPv6 equivalent of IPv4 [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private addresses.
* @returns {boolean}
*/
isULA(): boolean;
/**
* Returns true if the address is the unspecified address `::`.
* @returns {boolean}
*/
isUnspecified(): boolean;
/**
* Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)).
* @returns {boolean}
*/
isDocumentation(): boolean;
/**
* Returns the address as an HTTP URL with the host bracketed, e.g.
* `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended,
* e.g. `http://[2001:db8::1]:8080/`.
*/
href(optionalPort?: number | string): string;
/**
* Returns an HTML `<a>` element whose `href` encodes the address in a URL
* hash fragment (default prefix `/#address=`). Useful for linking between
* pages of an address-inspector UI.
* @param options.className - CSS class for the rendered `<a>` element
* @param options.prefix - hash prefix prepended to the address (default `/#address=`)
* @param options.v4 - when true, render the address in v4-in-v6 form
*/
link(options?: {
className?: string;
prefix?: string;
v4?: boolean;
}): string;
/**
* Groups an address
* @returns {String}
*/
group(): string;
/**
* Generate a regular expression string that can be used to find or validate
* all variations of this address
* @param {boolean} substringSearch
* @returns {string}
*/
regularExpressionString(this: Address6, substringSearch?: boolean): string;
/**
* Generate a regular expression that can be used to find or validate all
* variations of this address.
* @param {boolean} substringSearch
* @returns {RegExp}
*/
regularExpression(this: Address6, substringSearch?: boolean): RegExp;
}
export {};

1217
electron/node_modules/ip-address/dist/ipv6.js generated vendored Normal file

File diff suppressed because it is too large Load diff

1
electron/node_modules/ip-address/dist/ipv6.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
export declare const BITS = 32;
export declare const GROUPS = 4;
export declare const RE_ADDRESS: RegExp;
export declare const RE_SUBNET_STRING: RegExp;

View file

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RE_SUBNET_STRING = exports.RE_ADDRESS = exports.GROUPS = exports.BITS = void 0;
exports.BITS = 32;
exports.GROUPS = 4;
exports.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;
exports.RE_SUBNET_STRING = /\/\d{1,2}$/;
//# sourceMappingURL=constants.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/v4/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,EAAE,CAAC;AACV,QAAA,MAAM,GAAG,CAAC,CAAC;AAEX,QAAA,UAAU,GACrB,mKAAmK,CAAC;AAEzJ,QAAA,gBAAgB,GAAG,YAAY,CAAC","sourcesContent":["export const BITS = 32;\nexport const GROUPS = 4;\n\nexport const RE_ADDRESS =\n /^(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;\n\nexport const RE_SUBNET_STRING = /\\/\\d{1,2}$/;\n"]}

View file

@ -0,0 +1,44 @@
export declare const BITS = 128;
export declare const GROUPS = 8;
/**
* Represents IPv6 address scopes
* @memberof Address6
* @static
*/
export declare const SCOPES: {
[key: number]: string | undefined;
};
/**
* Represents IPv6 address types
* @memberof Address6
* @static
*/
export declare const TYPES: {
[key: string]: string | undefined;
};
/**
* A regular expression that matches bad characters in an IPv6 address
* @memberof Address6
* @static
*/
export declare const RE_BAD_CHARACTERS: RegExp;
/**
* A regular expression that matches an incorrect IPv6 address
* @memberof Address6
* @static
*/
export declare const RE_BAD_ADDRESS: RegExp;
/**
* A regular expression that matches an IPv6 subnet
* @memberof Address6
* @static
*/
export declare const RE_SUBNET_STRING: RegExp;
/**
* A regular expression that matches an IPv6 zone
* @memberof Address6
* @static
*/
export declare const RE_ZONE_STRING: RegExp;
export declare const RE_URL: RegExp;
export declare const RE_URL_WITH_PORT: RegExp;

81
electron/node_modules/ip-address/dist/v6/constants.js generated vendored Normal file
View file

@ -0,0 +1,81 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RE_URL_WITH_PORT = exports.RE_URL = exports.RE_ZONE_STRING = exports.RE_SUBNET_STRING = exports.RE_BAD_ADDRESS = exports.RE_BAD_CHARACTERS = exports.TYPES = exports.SCOPES = exports.GROUPS = exports.BITS = void 0;
exports.BITS = 128;
exports.GROUPS = 8;
/**
* Represents IPv6 address scopes
* @memberof Address6
* @static
*/
exports.SCOPES = {
0: 'Reserved',
1: 'Interface local',
2: 'Link local',
4: 'Admin local',
5: 'Site local',
8: 'Organization local',
14: 'Global',
15: 'Reserved',
};
/**
* Represents IPv6 address types
* @memberof Address6
* @static
*/
exports.TYPES = {
'ff01::1/128': 'Multicast (All nodes on this interface)',
'ff01::2/128': 'Multicast (All routers on this interface)',
'ff02::1/128': 'Multicast (All nodes on this link)',
'ff02::2/128': 'Multicast (All routers on this link)',
'ff05::2/128': 'Multicast (All routers in this site)',
'ff02::5/128': 'Multicast (OSPFv3 AllSPF routers)',
'ff02::6/128': 'Multicast (OSPFv3 AllDR routers)',
'ff02::9/128': 'Multicast (RIP routers)',
'ff02::a/128': 'Multicast (EIGRP routers)',
'ff02::d/128': 'Multicast (PIM routers)',
'ff02::16/128': 'Multicast (MLDv2 reports)',
'ff01::fb/128': 'Multicast (mDNSv6)',
'ff02::fb/128': 'Multicast (mDNSv6)',
'ff05::fb/128': 'Multicast (mDNSv6)',
'ff02::1:2/128': 'Multicast (All DHCP servers and relay agents on this link)',
'ff05::1:2/128': 'Multicast (All DHCP servers and relay agents in this site)',
'ff02::1:3/128': 'Multicast (All DHCP servers on this link)',
'ff05::1:3/128': 'Multicast (All DHCP servers in this site)',
'::/128': 'Unspecified',
'::1/128': 'Loopback',
'ff00::/8': 'Multicast',
'fe80::/10': 'Link-local unicast',
'fc00::/7': 'Unique local',
'2002::/16': '6to4',
'2001:db8::/32': 'Documentation',
'64:ff9b::/96': 'NAT64 (well-known)',
'64:ff9b:1::/48': 'NAT64 (local-use)',
};
/**
* A regular expression that matches bad characters in an IPv6 address
* @memberof Address6
* @static
*/
exports.RE_BAD_CHARACTERS = /([^0-9a-f:/%])/gi;
/**
* A regular expression that matches an incorrect IPv6 address
* @memberof Address6
* @static
*/
exports.RE_BAD_ADDRESS = /([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;
/**
* A regular expression that matches an IPv6 subnet
* @memberof Address6
* @static
*/
exports.RE_SUBNET_STRING = /\/\d{1,3}(?=%|$)/;
/**
* A regular expression that matches an IPv6 zone
* @memberof Address6
* @static
*/
exports.RE_ZONE_STRING = /%.*$/;
exports.RE_URL = /^\[{0,1}([0-9a-f:]+)\]{0,1}/;
exports.RE_URL_WITH_PORT = /\[([0-9a-f:]+)\]:([0-9]{1,5})/;
//# sourceMappingURL=constants.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/v6/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,GAAG,CAAC;AACX,QAAA,MAAM,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACU,QAAA,MAAM,GAA0C;IAC3D,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,iBAAiB;IACpB,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,aAAa;IAChB,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,oBAAoB;IACvB,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,UAAU;CACN,CAAC;AAEX;;;;GAIG;AACU,QAAA,KAAK,GAA0C;IAC1D,aAAa,EAAE,yCAAyC;IACxD,aAAa,EAAE,2CAA2C;IAC1D,aAAa,EAAE,oCAAoC;IACnD,aAAa,EAAE,sCAAsC;IACrD,aAAa,EAAE,sCAAsC;IACrD,aAAa,EAAE,mCAAmC;IAClD,aAAa,EAAE,kCAAkC;IACjD,aAAa,EAAE,yBAAyB;IACxC,aAAa,EAAE,2BAA2B;IAC1C,aAAa,EAAE,yBAAyB;IACxC,cAAc,EAAE,2BAA2B;IAC3C,cAAc,EAAE,oBAAoB;IACpC,cAAc,EAAE,oBAAoB;IACpC,cAAc,EAAE,oBAAoB;IACpC,eAAe,EAAE,4DAA4D;IAC7E,eAAe,EAAE,4DAA4D;IAC7E,eAAe,EAAE,2CAA2C;IAC5D,eAAe,EAAE,2CAA2C;IAC5D,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,UAAU;IACrB,UAAU,EAAE,WAAW;IACvB,WAAW,EAAE,oBAAoB;IACjC,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,eAAe;IAChC,cAAc,EAAE,oBAAoB;IACpC,gBAAgB,EAAE,mBAAmB;CAC7B,CAAC;AAEX;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,kBAAkB,CAAC;AAEpD;;;;GAIG;AACU,QAAA,cAAc,GAAG,0CAA0C,CAAC;AAEzE;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AAEnD;;;;GAIG;AACU,QAAA,cAAc,GAAG,MAAM,CAAC;AAExB,QAAA,MAAM,GAAG,6BAA6B,CAAC;AACvC,QAAA,gBAAgB,GAAG,+BAA+B,CAAC","sourcesContent":["export const BITS = 128;\nexport const GROUPS = 8;\n\n/**\n * Represents IPv6 address scopes\n * @memberof Address6\n * @static\n */\nexport const SCOPES: { [key: number]: string | undefined } = {\n 0: 'Reserved',\n 1: 'Interface local',\n 2: 'Link local',\n 4: 'Admin local',\n 5: 'Site local',\n 8: 'Organization local',\n 14: 'Global',\n 15: 'Reserved',\n} as const;\n\n/**\n * Represents IPv6 address types\n * @memberof Address6\n * @static\n */\nexport const TYPES: { [key: string]: string | undefined } = {\n 'ff01::1/128': 'Multicast (All nodes on this interface)',\n 'ff01::2/128': 'Multicast (All routers on this interface)',\n 'ff02::1/128': 'Multicast (All nodes on this link)',\n 'ff02::2/128': 'Multicast (All routers on this link)',\n 'ff05::2/128': 'Multicast (All routers in this site)',\n 'ff02::5/128': 'Multicast (OSPFv3 AllSPF routers)',\n 'ff02::6/128': 'Multicast (OSPFv3 AllDR routers)',\n 'ff02::9/128': 'Multicast (RIP routers)',\n 'ff02::a/128': 'Multicast (EIGRP routers)',\n 'ff02::d/128': 'Multicast (PIM routers)',\n 'ff02::16/128': 'Multicast (MLDv2 reports)',\n 'ff01::fb/128': 'Multicast (mDNSv6)',\n 'ff02::fb/128': 'Multicast (mDNSv6)',\n 'ff05::fb/128': 'Multicast (mDNSv6)',\n 'ff02::1:2/128': 'Multicast (All DHCP servers and relay agents on this link)',\n 'ff05::1:2/128': 'Multicast (All DHCP servers and relay agents in this site)',\n 'ff02::1:3/128': 'Multicast (All DHCP servers on this link)',\n 'ff05::1:3/128': 'Multicast (All DHCP servers in this site)',\n '::/128': 'Unspecified',\n '::1/128': 'Loopback',\n 'ff00::/8': 'Multicast',\n 'fe80::/10': 'Link-local unicast',\n 'fc00::/7': 'Unique local',\n '2002::/16': '6to4',\n '2001:db8::/32': 'Documentation',\n '64:ff9b::/96': 'NAT64 (well-known)',\n '64:ff9b:1::/48': 'NAT64 (local-use)',\n} as const;\n\n/**\n * A regular expression that matches bad characters in an IPv6 address\n * @memberof Address6\n * @static\n */\nexport const RE_BAD_CHARACTERS = /([^0-9a-f:/%])/gi;\n\n/**\n * A regular expression that matches an incorrect IPv6 address\n * @memberof Address6\n * @static\n */\nexport const RE_BAD_ADDRESS = /([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\\/$)/gi;\n\n/**\n * A regular expression that matches an IPv6 subnet\n * @memberof Address6\n * @static\n */\nexport const RE_SUBNET_STRING = /\\/\\d{1,3}(?=%|$)/;\n\n/**\n * A regular expression that matches an IPv6 zone\n * @memberof Address6\n * @static\n */\nexport const RE_ZONE_STRING = /%.*$/;\n\nexport const RE_URL = /^\\[{0,1}([0-9a-f:]+)\\]{0,1}/;\nexport const RE_URL_WITH_PORT = /\\[([0-9a-f:]+)\\]:([0-9]{1,5})/;\n"]}

18
electron/node_modules/ip-address/dist/v6/helpers.d.ts generated vendored Normal file
View file

@ -0,0 +1,18 @@
export declare function escapeHtml(s: string): string;
/**
* @returns {String} the string with all zeroes contained in a <span>
*/
export declare function spanAllZeroes(s: string): string;
/**
* @returns {String} the string with each character contained in a <span>
*/
export declare function spanAll(s: string, offset?: number): string;
/**
* @returns {String} the string with leading zeroes contained in a <span>
*/
export declare function spanLeadingZeroes(address: string): string;
/**
* Groups an address
* @returns {String} a grouped address
*/
export declare function simpleGroup(addressString: string, offset?: number): string[];

54
electron/node_modules/ip-address/dist/v6/helpers.js generated vendored Normal file
View file

@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.escapeHtml = escapeHtml;
exports.spanAllZeroes = spanAllZeroes;
exports.spanAll = spanAll;
exports.spanLeadingZeroes = spanLeadingZeroes;
exports.simpleGroup = simpleGroup;
function escapeHtml(s) {
return s
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
}
/**
* @returns {String} the string with all zeroes contained in a <span>
*/
function spanAllZeroes(s) {
return escapeHtml(s).replace(/(0+)/g, '<span class="zero">$1</span>');
}
/**
* @returns {String} the string with each character contained in a <span>
*/
function spanAll(s, offset = 0) {
const letters = s.split('');
return letters
.map((n, i) => `<span class="digit value-${escapeHtml(n)} position-${i + offset}">${spanAllZeroes(n)}</span>`)
.join('');
}
function spanLeadingZeroesSimple(group) {
return escapeHtml(group).replace(/^(0+)/, '<span class="zero">$1</span>');
}
/**
* @returns {String} the string with leading zeroes contained in a <span>
*/
function spanLeadingZeroes(address) {
const groups = address.split(':');
return groups.map((g) => spanLeadingZeroesSimple(g)).join(':');
}
/**
* Groups an address
* @returns {String} a grouped address
*/
function simpleGroup(addressString, offset = 0) {
const groups = addressString.split(':');
return groups.map((g, i) => {
if (/group-v4/.test(g)) {
return g;
}
return `<span class="hover-group group-${i + offset}">${spanLeadingZeroesSimple(g)}</span>`;
});
}
//# sourceMappingURL=helpers.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/v6/helpers.ts"],"names":[],"mappings":";;AAAA,gCAOC;AAKD,sCAEC;AAKD,0BASC;AASD,8CAIC;AAMD,kCAUC;AAzDD,SAAgB,UAAU,CAAC,CAAS;IAClC,OAAO,CAAC;SACL,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,CAAS;IACrC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC;AACxE,CAAC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAC,CAAS,EAAE,SAAiB,CAAC;IACnD,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAE5B,OAAO,OAAO;SACX,GAAG,CACF,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,4BAA4B,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,SAAS,CACjG;SACA,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAa;IAC5C,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC;AAC5E,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,OAAe;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,aAAqB,EAAE,SAAiB,CAAC;IACnE,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAExC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACzB,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,kCAAkC,CAAC,GAAG,MAAM,KAAK,uBAAuB,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9F,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["export function escapeHtml(s: string): string {\n return s\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;');\n}\n\n/**\n * @returns {String} the string with all zeroes contained in a <span>\n */\nexport function spanAllZeroes(s: string): string {\n return escapeHtml(s).replace(/(0+)/g, '<span class=\"zero\">$1</span>');\n}\n\n/**\n * @returns {String} the string with each character contained in a <span>\n */\nexport function spanAll(s: string, offset: number = 0): string {\n const letters = s.split('');\n\n return letters\n .map(\n (n, i) =>\n `<span class=\"digit value-${escapeHtml(n)} position-${i + offset}\">${spanAllZeroes(n)}</span>`,\n )\n .join('');\n}\n\nfunction spanLeadingZeroesSimple(group: string): string {\n return escapeHtml(group).replace(/^(0+)/, '<span class=\"zero\">$1</span>');\n}\n\n/**\n * @returns {String} the string with leading zeroes contained in a <span>\n */\nexport function spanLeadingZeroes(address: string): string {\n const groups = address.split(':');\n\n return groups.map((g) => spanLeadingZeroesSimple(g)).join(':');\n}\n\n/**\n * Groups an address\n * @returns {String} a grouped address\n */\nexport function simpleGroup(addressString: string, offset: number = 0): string[] {\n const groups = addressString.split(':');\n\n return groups.map((g, i) => {\n if (/group-v4/.test(g)) {\n return g;\n }\n\n return `<span class=\"hover-group group-${i + offset}\">${spanLeadingZeroesSimple(g)}</span>`;\n });\n}\n"]}

View file

@ -0,0 +1,5 @@
export declare function groupPossibilities(possibilities: string[]): string;
export declare function padGroup(group: string): string;
export declare const ADDRESS_BOUNDARY = "[^A-Fa-f0-9:]";
export declare function simpleRegularExpression(groups: string[]): string;
export declare function possibleElisions(elidedGroups: number, moreLeft?: boolean, moreRight?: boolean): string;

View file

@ -0,0 +1,95 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ADDRESS_BOUNDARY = void 0;
exports.groupPossibilities = groupPossibilities;
exports.padGroup = padGroup;
exports.simpleRegularExpression = simpleRegularExpression;
exports.possibleElisions = possibleElisions;
const v6 = __importStar(require("./constants"));
function groupPossibilities(possibilities) {
return `(${possibilities.join('|')})`;
}
function padGroup(group) {
if (group.length < 4) {
return `0{0,${4 - group.length}}${group}`;
}
return group;
}
exports.ADDRESS_BOUNDARY = '[^A-Fa-f0-9:]';
function simpleRegularExpression(groups) {
const zeroIndexes = [];
groups.forEach((group, i) => {
const groupInteger = parseInt(group, 16);
if (groupInteger === 0) {
zeroIndexes.push(i);
}
});
// You can technically elide a single 0, this creates the regular expressions
// to match that eventuality
const possibilities = zeroIndexes.map((zeroIndex) => groups
.map((group, i) => {
if (i === zeroIndex) {
const elision = i === 0 || i === v6.GROUPS - 1 ? ':' : '';
return groupPossibilities([padGroup(group), elision]);
}
return padGroup(group);
})
.join(':'));
// The simplest case
possibilities.push(groups.map(padGroup).join(':'));
return groupPossibilities(possibilities);
}
function possibleElisions(elidedGroups, moreLeft, moreRight) {
const left = moreLeft ? '' : ':';
const right = moreRight ? '' : ':';
const possibilities = [];
// 1. elision of everything (::)
if (!moreLeft && !moreRight) {
possibilities.push('::');
}
// 2. complete elision of the middle
if (moreLeft && moreRight) {
possibilities.push('');
}
if ((moreRight && !moreLeft) || (!moreRight && moreLeft)) {
// 3. complete elision of one side
possibilities.push(':');
}
// 4. elision from the left side
possibilities.push(`${left}(:0{1,4}){1,${elidedGroups - 1}}`);
// 5. elision from the right side
possibilities.push(`(0{1,4}:){1,${elidedGroups - 1}}${right}`);
// 6. no elision
possibilities.push(`(0{1,4}:){${elidedGroups - 1}}0{1,4}`);
// 7. elision (including sloppy elision) from the middle
for (let groups = 1; groups < elidedGroups - 1; groups++) {
for (let position = 1; position < elidedGroups - groups; position++) {
possibilities.push(`(0{1,4}:){${position}}:(0{1,4}:){${elidedGroups - position - groups - 1}}0{1,4}`);
}
}
return groupPossibilities(possibilities);
}
//# sourceMappingURL=regular-expressions.js.map

File diff suppressed because one or more lines are too long