flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
19
BACK_BACK/node_modules/ip-address/LICENSE
generated
vendored
Executable file
19
BACK_BACK/node_modules/ip-address/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (C) 2011 by Beau Gunderson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
108
BACK_BACK/node_modules/ip-address/README.md
generated
vendored
Executable file
108
BACK_BACK/node_modules/ip-address/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,108 @@
|
|||

|
||||
[![codecov]](https://codecov.io/github/beaugunderson/ip-address?branch=master)
|
||||
[![downloads]](https://www.npmjs.com/package/ip-address)
|
||||
[![npm]](https://www.npmjs.com/package/ip-address)
|
||||
[![snyk]](https://snyk.io/test/github/beaugunderson/ip-address)
|
||||
|
||||
[codecov]: https://codecov.io/github/beaugunderson/ip-address/coverage.svg?branch=master
|
||||
[downloads]: https://img.shields.io/npm/dm/ip-address.svg
|
||||
[npm]: https://img.shields.io/npm/v/ip-address.svg
|
||||
[snyk]: https://snyk.io/test/github/beaugunderson/ip-address/badge.svg
|
||||
|
||||
## ip-address
|
||||
|
||||
`ip-address` is a library for validating and manipulating IPv4 and IPv6
|
||||
addresses in JavaScript.
|
||||
|
||||
|
||||
### Migrating from 6.x to 7.x
|
||||
|
||||
`ip-address` was rewritten in TypeScript for version 7. If you were using
|
||||
version 6 you'll need to make these changes to upgrade:
|
||||
|
||||
- Instead of checking `isValid()`, which has been removed, you'll need to use a
|
||||
`try`/`catch` if you're accepting unknown input. This made the TypeScript
|
||||
types substantially easier as well as allowed the use of an `AddressError`
|
||||
class which will contain a `parseMessage` if an error occurred in the parsing
|
||||
step.
|
||||
- Instead of using the `error`, `parseError`, and `valid` attributes you'll
|
||||
need to use the `message` and `parseMessage` of the thrown `AddressError`.
|
||||
|
||||
### Documentation
|
||||
|
||||
Documentation is available at [ip-address.js.org](http://ip-address.js.org/).
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
var Address6 = require('ip-address').Address6;
|
||||
|
||||
var address = new Address6('2001:0:ce49:7601:e866:efff:62c3:fffe');
|
||||
|
||||
var teredo = address.inspectTeredo();
|
||||
|
||||
teredo.client4; // '157.60.0.1'
|
||||
```
|
||||
|
||||
### Features
|
||||
|
||||
- Usable via CommonJS or ESM
|
||||
- Parsing of all IPv6 notations
|
||||
- Parsing of IPv6 addresses and ports from URLs with `Address6.fromURL(url)`
|
||||
- Validity checking
|
||||
- Decoding of the [Teredo
|
||||
information](http://en.wikipedia.org/wiki/Teredo_tunneling#IPv6_addressing)
|
||||
in an address
|
||||
- Whether one address is a valid subnet of another
|
||||
- What special properties a given address has (multicast prefix, unique
|
||||
local address prefix, etc.)
|
||||
- Number of subnets of a certain size in a given address
|
||||
- Display methods
|
||||
- Hex, binary, and decimal
|
||||
- Canonical form
|
||||
- Correct form
|
||||
- IPv4-compatible (i.e. `::ffff:192.168.0.1`)
|
||||
- Works in [node](http://nodejs.org/) and the browser (with browserify)
|
||||
- ~1,600 test cases
|
||||
|
||||
### Used by
|
||||
|
||||
- [anon](https://github.com/edsu/anon) which powers
|
||||
[@congressedits](https://twitter.com/congressedits), among
|
||||
[many others](https://github.com/edsu/anon#community)
|
||||
- [base85](https://github.com/noseglid/base85): base85 encoding/decoding
|
||||
- [contrail-web-core](https://github.com/Juniper/contrail-web-core): part of
|
||||
Contrail, a network virtualization solution made by Juniper Networks
|
||||
- [dhcpjs](https://github.com/apaprocki/node-dhcpjs): a DHCP client and server
|
||||
- [epochtalk](https://github.com/epochtalk/epochtalk): next generation forum
|
||||
software
|
||||
- [geoip-web](https://github.com/tfrce/node-geoip-web): a server for
|
||||
quickly geolocating IP addresses
|
||||
- [hexabus](https://github.com/mysmartgrid/hexabus): an IPv6-based home
|
||||
automation bus
|
||||
- [hubot-deploy](https://github.com/atmos/hubot-deploy): GitHub Flow via hubot
|
||||
- [heroku-portscanner](https://github.com/robison/heroku-portscanner): nmap
|
||||
hosted on Heroku
|
||||
- [ipfs-swarm](https://github.com/diasdavid/node-ipfs-swarm): a swarm
|
||||
implementation based on IPFS
|
||||
- [javascript-x-server](https://github.com/GothAck/javascript-x-server): an X
|
||||
server written in JavaScript
|
||||
- [libnmap](https://github.com/jas-/node-libnmap): a node API for nmap
|
||||
- [mail-io](https://github.com/mofux/mail-io): a lightweight SMTP server
|
||||
- [maxmind-db-reader](https://github.com/PaddeK/node-maxmind-db): a library for
|
||||
reading MaxMind database files
|
||||
- [proxy-protocol-v2](https://github.com/ably/proxy-protocol-v2): a proxy
|
||||
protocol encoder/decoder built by [Ably](https://www.ably.io/)
|
||||
- [Samsara](https://github.com/mariusGundersen/Samsara): a Docker web interface
|
||||
- [sis-api](https://github.com/sis-cmdb/sis-api): a configuration management
|
||||
database API
|
||||
- [socks5-client](https://github.com/mattcg/socks5-client): a SOCKS v5 client
|
||||
- [socksified](https://github.com/vially/node-socksified): a SOCKS v5 client
|
||||
- [socksv5](https://github.com/mscdex/socksv5): a SOCKS v5 server/client
|
||||
- [ssdapi](https://github.com/rsolomou/ssdapi): an API created by the
|
||||
University of Portsmouth
|
||||
- [SwitchyOmega](https://github.com/FelisCatus/SwitchyOmega): a [Chrome
|
||||
extension](https://chrome.google.com/webstore/detail/padekgcemlokbadohgkifijomclgjgif)
|
||||
for switching between multiple proxies with ~311k users!
|
||||
- [swiz](https://github.com/racker/node-swiz): a serialization framework built
|
||||
and used by [Rackspace](http://www.rackspace.com/)
|
||||
5
BACK_BACK/node_modules/ip-address/dist/address-error.d.ts
generated
vendored
Executable file
5
BACK_BACK/node_modules/ip-address/dist/address-error.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
export declare class AddressError extends Error {
|
||||
parseMessage?: string;
|
||||
constructor(message: string, parseMessage?: string);
|
||||
}
|
||||
//# sourceMappingURL=address-error.d.ts.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/address-error.d.ts.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/address-error.d.ts.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"address-error.d.ts","sourceRoot":"","sources":["../src/address-error.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;CASnD"}
|
||||
14
BACK_BACK/node_modules/ip-address/dist/address-error.js
generated
vendored
Executable file
14
BACK_BACK/node_modules/ip-address/dist/address-error.js
generated
vendored
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AddressError = void 0;
|
||||
class AddressError extends Error {
|
||||
constructor(message, parseMessage) {
|
||||
super(message);
|
||||
this.name = 'AddressError';
|
||||
if (parseMessage !== null) {
|
||||
this.parseMessage = parseMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.AddressError = AddressError;
|
||||
//# sourceMappingURL=address-error.js.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/address-error.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/address-error.js.map
generated
vendored
Executable 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,YAAY,KAAK,IAAI,EAAE;YACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;SAClC;IACH,CAAC;CACF;AAZD,oCAYC"}
|
||||
8
BACK_BACK/node_modules/ip-address/dist/common.d.ts
generated
vendored
Executable file
8
BACK_BACK/node_modules/ip-address/dist/common.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
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;
|
||||
//# sourceMappingURL=common.d.ts.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/common.d.ts.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/common.d.ts.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAG,QAAQ,WAUjF;AAED,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,UACpB,QAAQ,GAAG,QAAQ,aAW3C"}
|
||||
26
BACK_BACK/node_modules/ip-address/dist/common.js
generated
vendored
Executable file
26
BACK_BACK/node_modules/ip-address/dist/common.js
generated
vendored
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isCorrect = exports.isInSubnet = void 0;
|
||||
function isInSubnet(address) {
|
||||
if (this.subnetMask < address.subnetMask) {
|
||||
return false;
|
||||
}
|
||||
if (this.mask(address.subnetMask) === address.mask()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.isInSubnet = isInSubnet;
|
||||
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);
|
||||
};
|
||||
}
|
||||
exports.isCorrect = isCorrect;
|
||||
//# sourceMappingURL=common.js.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/common.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/common.js.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":";;;AAOA,SAAgB,UAAU,CAA4B,OAA4B;IAChF,IAAI,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE;QACxC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE,EAAE;QACpD,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,gCAUC;AAED,SAAgB,SAAS,CAAC,WAAmB;IAC3C,OAAO;QACL,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI,CAAC,WAAW,EAAE,EAAE;YAClD,OAAO,KAAK,CAAC;SACd;QAED,IAAI,IAAI,CAAC,UAAU,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACzD,OAAO,IAAI,CAAC;SACb;QAED,OAAO,IAAI,CAAC,YAAY,KAAK,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC;AAZD,8BAYC"}
|
||||
11
BACK_BACK/node_modules/ip-address/dist/ip-address.d.ts
generated
vendored
Executable file
11
BACK_BACK/node_modules/ip-address/dist/ip-address.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
import { Address4 } from './ipv4';
|
||||
import { Address6 } from './ipv6';
|
||||
import { AddressError } from './address-error';
|
||||
export { Address4 };
|
||||
export { Address6 };
|
||||
export { AddressError };
|
||||
import * as helpers from './v6/helpers';
|
||||
export declare const v6: {
|
||||
helpers: typeof helpers;
|
||||
};
|
||||
//# sourceMappingURL=ip-address.d.ts.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/ip-address.d.ts.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/ip-address.d.ts.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ip-address.d.ts","sourceRoot":"","sources":["../src/ip-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,EAAE;;CAAc,CAAC"}
|
||||
35
BACK_BACK/node_modules/ip-address/dist/ip-address.js
generated
vendored
Executable file
35
BACK_BACK/node_modules/ip-address/dist/ip-address.js
generated
vendored
Executable 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;
|
||||
const ipv4_1 = require("./ipv4");
|
||||
Object.defineProperty(exports, "Address4", { enumerable: true, get: function () { return ipv4_1.Address4; } });
|
||||
const ipv6_1 = require("./ipv6");
|
||||
Object.defineProperty(exports, "Address6", { enumerable: true, get: function () { return ipv6_1.Address6; } });
|
||||
const 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
|
||||
1
BACK_BACK/node_modules/ip-address/dist/ip-address.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/ip-address.js.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ip-address.js","sourceRoot":"","sources":["../src/ip-address.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAkC;AAIzB,yFAJA,eAAQ,OAIA;AAHjB,iCAAkC;AAIzB,yFAJA,eAAQ,OAIA;AAHjB,mDAA+C;AAItC,6FAJA,4BAAY,OAIA;AAErB,sDAAwC;AAE3B,QAAA,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC"}
|
||||
194
BACK_BACK/node_modules/ip-address/dist/ipv4.d.ts
generated
vendored
Executable file
194
BACK_BACK/node_modules/ip-address/dist/ipv4.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,194 @@
|
|||
import * as common from './common';
|
||||
import { BigInteger } from 'jsbn';
|
||||
/**
|
||||
* Represents an IPv4 address
|
||||
* @class Address4
|
||||
* @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;
|
||||
constructor(address: string);
|
||||
static isValid(address: string): boolean;
|
||||
parse(address: string): string[];
|
||||
/**
|
||||
* Returns the correct form of an address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
correctForm(): string;
|
||||
/**
|
||||
* Returns true if the address is correct, false otherwise
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isCorrect: (this: Address4 | import("./ipv6").Address6) => boolean;
|
||||
/**
|
||||
* Converts a hex string to an IPv4 address object
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @param {string} hex - a hex string to convert
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromHex(hex: string): Address4;
|
||||
/**
|
||||
* Converts an integer into a IPv4 address object
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @param {integer} integer - a number to convert
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromInteger(integer: number): Address4;
|
||||
/**
|
||||
* Return an address from in-addr.arpa form
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @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
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
toHex(): string;
|
||||
/**
|
||||
* Converts an IPv4 address object to an array of bytes
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Array}
|
||||
*/
|
||||
toArray(): number[];
|
||||
/**
|
||||
* Converts an IPv4 address object to an IPv6 address group
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
toGroup6(): string;
|
||||
/**
|
||||
* Returns the address as a BigInteger
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
bigInteger(): BigInteger;
|
||||
/**
|
||||
* Helper function getting start address.
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
_startAddress(): BigInteger;
|
||||
/**
|
||||
* The first address in the range given by this address' subnet.
|
||||
* Often referred to as the Network Address.
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @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
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
*/
|
||||
startAddressExclusive(): Address4;
|
||||
/**
|
||||
* Helper function getting end address.
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
_endAddress(): BigInteger;
|
||||
/**
|
||||
* The last address in the range given by this address' subnet
|
||||
* Often referred to as the Broadcast
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @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
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
*/
|
||||
endAddressExclusive(): Address4;
|
||||
/**
|
||||
* Converts a BigInteger to a v4 address object
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @param {BigInteger} bigInteger - a BigInteger to convert
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromBigInteger(bigInteger: BigInteger): Address4;
|
||||
/**
|
||||
* Returns the first n bits of the address, defaulting to the
|
||||
* subnet mask
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
mask(mask?: number): string;
|
||||
/**
|
||||
* Returns the bits in the given range as a base-2 string
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {string}
|
||||
*/
|
||||
getBitsBase2(start: number, end: number): string;
|
||||
/**
|
||||
* Return the reversed ip6.arpa form of the address
|
||||
* @memberof Address4
|
||||
* @param {Object} options
|
||||
* @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
reverseForm(options?: common.ReverseFormOptions): string;
|
||||
/**
|
||||
* Returns true if the given address is in the subnet of the current address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isInSubnet: typeof common.isInSubnet;
|
||||
/**
|
||||
* Returns true if the given address is a multicast address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMulticast(): boolean;
|
||||
/**
|
||||
* Returns a zero-padded base-2 string representation of the address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {string}
|
||||
*/
|
||||
binaryZeroPad(): string;
|
||||
/**
|
||||
* Groups an IPv4 address for inclusion at the end of an IPv6 address
|
||||
* @returns {String}
|
||||
*/
|
||||
groupForV6(): string;
|
||||
}
|
||||
//# sourceMappingURL=ipv4.d.ts.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/ipv4.d.ts.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/ipv4.d.ts.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ipv4.d.ts","sourceRoot":"","sources":["../src/ipv4.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAGnC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGlC;;;;GAIG;AACH,qBAAa,QAAQ;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAoB;IAClC,aAAa,EAAE,MAAM,EAAE,CAAM;IAC7B,YAAY,EAAE,MAAM,CAAM;IAC1B,MAAM,EAAE,MAAM,CAAS;IACvB,UAAU,EAAE,MAAM,CAAM;IACxB,EAAE,EAAE,OAAO,CAAQ;gBAEP,OAAO,EAAE,MAAM;IAsB3B,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAcxC,KAAK,CAAC,OAAO,EAAE,MAAM;IAUrB;;;;;OAKG;IACH,WAAW,IAAI,MAAM;IAIrB;;;;;OAKG;IACH,SAAS,0DAAoC;IAE7C;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;IAcrC;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ;IAI7C;;;;;;;;;OASG;IACH,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ;IASlD;;;;;OAKG;IACH,KAAK,IAAI,MAAM;IAIf;;;;;OAKG;IACH,OAAO,IAAI,MAAM,EAAE;IAInB;;;;;OAKG;IACH,QAAQ,IAAI,MAAM;IAiBlB;;;;;OAKG;IACH,UAAU,IAAI,UAAU;IAOxB;;;;;OAKG;IACH,aAAa,IAAI,UAAU;IAI3B;;;;;;OAMG;IACH,YAAY,IAAI,QAAQ;IAIxB;;;;;;OAMG;IACH,qBAAqB,IAAI,QAAQ;IAKjC;;;;;OAKG;IACH,WAAW,IAAI,UAAU;IAIzB;;;;;;OAMG;IACH,UAAU,IAAI,QAAQ;IAItB;;;;;;OAMG;IACH,mBAAmB,IAAI,QAAQ;IAK/B;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ;IAIvD;;;;;;OAMG;IACH,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;IAQ3B;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAIhD;;;;;;;OAOG;IACH,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,kBAAkB,GAAG,MAAM;IAcxD;;;;;OAKG;IACH,UAAU,2BAAqB;IAE/B;;;;;OAKG;IACH,WAAW,IAAI,OAAO;IAItB;;;;;OAKG;IACH,aAAa,IAAI,MAAM;IAIvB;;;OAGG;IACH,UAAU,IAAI,MAAM;CAYrB"}
|
||||
326
BACK_BACK/node_modules/ip-address/dist/ipv4.js
generated
vendored
Executable file
326
BACK_BACK/node_modules/ip-address/dist/ipv4.js
generated
vendored
Executable file
|
|
@ -0,0 +1,326 @@
|
|||
"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 jsbn_1 = require("jsbn");
|
||||
const sprintf_js_1 = require("sprintf-js");
|
||||
/**
|
||||
* Represents an IPv4 address
|
||||
* @class Address4
|
||||
* @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
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
this.isCorrect = common.isCorrect(constants.BITS);
|
||||
/**
|
||||
* Returns true if the given address is in the subnet of the current address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @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);
|
||||
}
|
||||
static isValid(address) {
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
new Address4(address);
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Parses a v4 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 correct form of an address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
correctForm() {
|
||||
return this.parsedAddress.map((part) => parseInt(part, 10)).join('.');
|
||||
}
|
||||
/**
|
||||
* Converts a hex string to an IPv4 address object
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @param {string} hex - a hex string to convert
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromHex(hex) {
|
||||
const padded = hex.replace(/:/g, '').padStart(8, '0');
|
||||
const groups = [];
|
||||
let i;
|
||||
for (i = 0; i < 8; i += 2) {
|
||||
const h = padded.slice(i, i + 2);
|
||||
groups.push(parseInt(h, 16));
|
||||
}
|
||||
return new Address4(groups.join('.'));
|
||||
}
|
||||
/**
|
||||
* Converts an integer into a IPv4 address object
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @param {integer} integer - a number to convert
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromInteger(integer) {
|
||||
return Address4.fromHex(integer.toString(16));
|
||||
}
|
||||
/**
|
||||
* Return an address from in-addr.arpa form
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @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
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
toHex() {
|
||||
return this.parsedAddress.map((part) => (0, sprintf_js_1.sprintf)('%02x', parseInt(part, 10))).join(':');
|
||||
}
|
||||
/**
|
||||
* Converts an IPv4 address object to an array of bytes
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Array}
|
||||
*/
|
||||
toArray() {
|
||||
return this.parsedAddress.map((part) => parseInt(part, 10));
|
||||
}
|
||||
/**
|
||||
* Converts an IPv4 address object to an IPv6 address group
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
toGroup6() {
|
||||
const output = [];
|
||||
let i;
|
||||
for (i = 0; i < constants.GROUPS; i += 2) {
|
||||
const hex = (0, sprintf_js_1.sprintf)('%02x%02x', parseInt(this.parsedAddress[i], 10), parseInt(this.parsedAddress[i + 1], 10));
|
||||
output.push((0, sprintf_js_1.sprintf)('%x', parseInt(hex, 16)));
|
||||
}
|
||||
return output.join(':');
|
||||
}
|
||||
/**
|
||||
* Returns the address as a BigInteger
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
bigInteger() {
|
||||
return new jsbn_1.BigInteger(this.parsedAddress.map((n) => (0, sprintf_js_1.sprintf)('%02x', parseInt(n, 10))).join(''), 16);
|
||||
}
|
||||
/**
|
||||
* Helper function getting start address.
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
_startAddress() {
|
||||
return new jsbn_1.BigInteger(this.mask() + '0'.repeat(constants.BITS - this.subnetMask), 2);
|
||||
}
|
||||
/**
|
||||
* The first address in the range given by this address' subnet.
|
||||
* Often referred to as the Network Address.
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
*/
|
||||
startAddress() {
|
||||
return Address4.fromBigInteger(this._startAddress());
|
||||
}
|
||||
/**
|
||||
* The first host address in the range given by this address's subnet ie
|
||||
* the first address after the Network Address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
*/
|
||||
startAddressExclusive() {
|
||||
const adjust = new jsbn_1.BigInteger('1');
|
||||
return Address4.fromBigInteger(this._startAddress().add(adjust));
|
||||
}
|
||||
/**
|
||||
* Helper function getting end address.
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
_endAddress() {
|
||||
return new jsbn_1.BigInteger(this.mask() + '1'.repeat(constants.BITS - this.subnetMask), 2);
|
||||
}
|
||||
/**
|
||||
* The last address in the range given by this address' subnet
|
||||
* Often referred to as the Broadcast
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
*/
|
||||
endAddress() {
|
||||
return Address4.fromBigInteger(this._endAddress());
|
||||
}
|
||||
/**
|
||||
* The last host address in the range given by this address's subnet ie
|
||||
* the last address prior to the Broadcast Address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
*/
|
||||
endAddressExclusive() {
|
||||
const adjust = new jsbn_1.BigInteger('1');
|
||||
return Address4.fromBigInteger(this._endAddress().subtract(adjust));
|
||||
}
|
||||
/**
|
||||
* Converts a BigInteger to a v4 address object
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @param {BigInteger} bigInteger - a BigInteger to convert
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromBigInteger(bigInteger) {
|
||||
return Address4.fromInteger(parseInt(bigInteger.toString(), 10));
|
||||
}
|
||||
/**
|
||||
* Returns the first n bits of the address, defaulting to the
|
||||
* subnet mask
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @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
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {string}
|
||||
*/
|
||||
getBitsBase2(start, end) {
|
||||
return this.binaryZeroPad().slice(start, end);
|
||||
}
|
||||
/**
|
||||
* Return the reversed ip6.arpa form of the address
|
||||
* @memberof Address4
|
||||
* @param {Object} options
|
||||
* @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
reverseForm(options) {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
const reversed = this.correctForm().split('.').reverse().join('.');
|
||||
if (options.omitSuffix) {
|
||||
return reversed;
|
||||
}
|
||||
return (0, sprintf_js_1.sprintf)('%s.in-addr.arpa.', reversed);
|
||||
}
|
||||
/**
|
||||
* Returns true if the given address is a multicast address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMulticast() {
|
||||
return this.isInSubnet(new Address4('224.0.0.0/4'));
|
||||
}
|
||||
/**
|
||||
* Returns a zero-padded base-2 string representation of the address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {string}
|
||||
*/
|
||||
binaryZeroPad() {
|
||||
return this.bigInteger().toString(2).padStart(constants.BITS, '0');
|
||||
}
|
||||
/**
|
||||
* 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, (0, sprintf_js_1.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>', segments.slice(0, 2).join('.'), segments.slice(2, 4).join('.')));
|
||||
}
|
||||
}
|
||||
exports.Address4 = Address4;
|
||||
//# sourceMappingURL=ipv4.js.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/ipv4.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/ipv4.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
429
BACK_BACK/node_modules/ip-address/dist/ipv6.d.ts
generated
vendored
Executable file
429
BACK_BACK/node_modules/ip-address/dist/ipv6.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,429 @@
|
|||
import * as common from './common';
|
||||
import { Address4 } from './ipv4';
|
||||
import { BigInteger } from 'jsbn';
|
||||
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
|
||||
* @class Address6
|
||||
* @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;
|
||||
constructor(address: string, optionalGroups?: number);
|
||||
static isValid(address: string): boolean;
|
||||
/**
|
||||
* Convert a BigInteger to a v6 address object
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @param {BigInteger} bigInteger - a BigInteger to convert
|
||||
* @returns {Address6}
|
||||
* @example
|
||||
* var bigInteger = new BigInteger('1000000000000');
|
||||
* var address = Address6.fromBigInteger(bigInteger);
|
||||
* address.correctForm(); // '::e8:d4a5:1000'
|
||||
*/
|
||||
static fromBigInteger(bigInteger: BigInteger): Address6;
|
||||
/**
|
||||
* Convert a URL (with optional port number) to an address object
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @param {string} url - a URL with optional port number
|
||||
* @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;
|
||||
};
|
||||
/**
|
||||
* Create an IPv6-mapped address given an IPv4 address
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @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
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @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
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String} the Microsoft UNC transcription of the address
|
||||
*/
|
||||
microsoftTranscription(): string;
|
||||
/**
|
||||
* Return the first n bits of the address, defaulting to the subnet mask
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @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
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @param {number} [size=128] - the subnet size
|
||||
* @returns {String}
|
||||
*/
|
||||
possibleSubnets(subnetSize?: number): string;
|
||||
/**
|
||||
* Helper function getting start address.
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
_startAddress(): BigInteger;
|
||||
/**
|
||||
* The first address in the range given by this address' subnet
|
||||
* Often referred to as the Network Address.
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @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
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Address6}
|
||||
*/
|
||||
startAddressExclusive(): Address6;
|
||||
/**
|
||||
* Helper function getting end address.
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
_endAddress(): BigInteger;
|
||||
/**
|
||||
* The last address in the range given by this address' subnet
|
||||
* Often referred to as the Broadcast
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @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
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Address6}
|
||||
*/
|
||||
endAddressExclusive(): Address6;
|
||||
/**
|
||||
* Return the scope of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
getScope(): string;
|
||||
/**
|
||||
* Return the type of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
getType(): string;
|
||||
/**
|
||||
* Return the bits in the given range as a BigInteger
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
getBits(start: number, end: number): BigInteger;
|
||||
/**
|
||||
* Return the bits in the given range as a base-2 string
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
getBitsBase2(start: number, end: number): string;
|
||||
/**
|
||||
* Return the bits in the given range as a base-16 string
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
getBitsBase16(start: number, end: number): string;
|
||||
/**
|
||||
* Return the bits that are set past the subnet mask length
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
getBitsPastSubnet(): string;
|
||||
/**
|
||||
* Return the reversed ip6.arpa form of the address
|
||||
* @memberof Address6
|
||||
* @param {Object} options
|
||||
* @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
reverseForm(options?: common.ReverseFormOptions): string;
|
||||
/**
|
||||
* Return the correct form of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
correctForm(): string;
|
||||
/**
|
||||
* Return a zero-padded base-2 string representation of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
* @example
|
||||
* var address = new Address6('2001:4860:4001:803::1011');
|
||||
* address.binaryZeroPad();
|
||||
* // '0010000000000001010010000110000001000000000000010000100000000011
|
||||
* // 0000000000000000000000000000000000000000000000000001000000010001'
|
||||
*/
|
||||
binaryZeroPad(): string;
|
||||
parse4in6(address: string): string;
|
||||
parse(address: string): string[];
|
||||
/**
|
||||
* Return the canonical form of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
canonicalForm(): string;
|
||||
/**
|
||||
* Return the decimal form of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
decimal(): string;
|
||||
/**
|
||||
* Return the address as a BigInteger
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
bigInteger(): BigInteger;
|
||||
/**
|
||||
* Return the last two groups of this address as an IPv4 address string
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @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
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
to4in6(): string;
|
||||
/**
|
||||
* Return an object containing the Teredo properties of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Object}
|
||||
*/
|
||||
inspectTeredo(): TeredoProperties;
|
||||
/**
|
||||
* Return an object containing the 6to4 properties of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Object}
|
||||
*/
|
||||
inspect6to4(): SixToFourProperties;
|
||||
/**
|
||||
* Return a v6 6to4 address from a v6 v4inv6 address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Address6}
|
||||
*/
|
||||
to6to4(): Address6 | null;
|
||||
/**
|
||||
* Return a byte array
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Array}
|
||||
*/
|
||||
toByteArray(): number[];
|
||||
/**
|
||||
* Return an unsigned byte array
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Array}
|
||||
*/
|
||||
toUnsignedByteArray(): number[];
|
||||
/**
|
||||
* Convert a byte array to an Address6 object
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @returns {Address6}
|
||||
*/
|
||||
static fromByteArray(bytes: Array<any>): Address6;
|
||||
/**
|
||||
* Convert an unsigned byte array to an Address6 object
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @returns {Address6}
|
||||
*/
|
||||
static fromUnsignedByteArray(bytes: Array<any>): Address6;
|
||||
/**
|
||||
* Returns true if the given address is in the subnet of the current address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isInSubnet: typeof common.isInSubnet;
|
||||
/**
|
||||
* Returns true if the address is correct, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isCorrect: (this: Address4 | Address6) => boolean;
|
||||
/**
|
||||
* Returns true if the address is in the canonical form, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isCanonical(): boolean;
|
||||
/**
|
||||
* Returns true if the address is a link local address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isLinkLocal(): boolean;
|
||||
/**
|
||||
* Returns true if the address is a multicast address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMulticast(): boolean;
|
||||
/**
|
||||
* Returns true if the address is a v4-in-v6 address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
is4(): boolean;
|
||||
/**
|
||||
* Returns true if the address is a Teredo address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isTeredo(): boolean;
|
||||
/**
|
||||
* Returns true if the address is a 6to4 address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
is6to4(): boolean;
|
||||
/**
|
||||
* Returns true if the address is a loopback address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isLoopback(): boolean;
|
||||
/**
|
||||
* @returns {String} the address in link form with a default port of 80
|
||||
*/
|
||||
href(optionalPort?: number | string): string;
|
||||
/**
|
||||
* @returns {String} a link suitable for conveying the address via a URL hash
|
||||
*/
|
||||
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
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @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.
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @param {boolean} substringSearch
|
||||
* @returns {RegExp}
|
||||
*/
|
||||
regularExpression(this: Address6, substringSearch?: boolean): RegExp;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=ipv6.d.ts.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/ipv6.d.ts.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/ipv6.d.ts.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ipv6.d.ts","sourceRoot":"","sources":["../src/ipv6.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAInC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAOlC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAuDlC,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE;QACT,QAAQ,EAAE,OAAO,CAAC;QAClB,cAAc,EAAE,OAAO,CAAC;QACxB,eAAe,EAAE,OAAO,CAAC;QACzB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,qBAAa,QAAQ;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAM;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAM;IAC1B,MAAM,EAAE,MAAM,CAAU;IACxB,UAAU,EAAE,MAAM,CAAO;IACzB,EAAE,EAAE,OAAO,CAAS;IACpB,IAAI,EAAE,MAAM,CAAM;gBAEN,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;IA0CpD,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAWxC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ;IAYvD;;;;;;;;;OASG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM;;;;;;;;;IA4D1B;;;;;;;;;;OAUG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ;IAQ9C;;;;;;;;;OASG;IACH,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ;IAsBlD;;;;;OAKG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;;;OAMG;IACH,IAAI,CAAC,IAAI,GAAE,MAAwB,GAAG,MAAM;IAI5C;;;;;;OAMG;IAEH,eAAe,CAAC,UAAU,GAAE,MAAY,GAAG,MAAM;IAYjD;;;;;OAKG;IACH,aAAa,IAAI,UAAU;IAI3B;;;;;;OAMG;IACH,YAAY,IAAI,QAAQ;IAIxB;;;;;;OAMG;IACH,qBAAqB,IAAI,QAAQ;IAKjC;;;;;OAKG;IACH,WAAW,IAAI,UAAU;IAIzB;;;;;;OAMG;IACH,UAAU,IAAI,QAAQ;IAItB;;;;;;OAMG;IACH,mBAAmB,IAAI,QAAQ;IAK/B;;;;;OAKG;IACH,QAAQ,IAAI,MAAM;IAUlB;;;;;OAKG;IACH,OAAO,IAAI,MAAM;IAUjB;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU;IAI/C;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAIhD;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAYjD;;;;;OAKG;IACH,iBAAiB,IAAI,MAAM;IAI3B;;;;;;;OAOG;IACH,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,kBAAkB,GAAG,MAAM;IA6BxD;;;;;OAKG;IACH,WAAW,IAAI,MAAM;IAqDrB;;;;;;;;;;OAUG;IACH,aAAa,IAAI,MAAM;IAKvB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAiClC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IA4EhC;;;;;OAKG;IACH,aAAa,IAAI,MAAM;IAIvB;;;;;OAKG;IACH,OAAO,IAAI,MAAM;IAIjB;;;;;OAKG;IACH,UAAU,IAAI,UAAU;IAIxB;;;;;;;;OAQG;IACH,GAAG,IAAI,QAAQ;IAMf;;;;;OAKG;IACH,MAAM,IAAI,MAAM;IAehB;;;;;OAKG;IACH,aAAa,IAAI,gBAAgB;IAwDjC;;;;;OAKG;IACH,WAAW,IAAI,mBAAmB;IAgBlC;;;;;OAKG;IACH,MAAM,IAAI,QAAQ,GAAG,IAAI;IAgBzB;;;;;OAKG;IACH,WAAW,IAAI,MAAM,EAAE;IAWvB;;;;;OAKG;IACH,mBAAmB,IAAI,MAAM,EAAE;IAI/B;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,QAAQ;IAIjD;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,QAAQ;IAezD;;;;;OAKG;IACH,UAAU,2BAAqB;IAE/B;;;;;OAKG;IACH,SAAS,yCAAqC;IAE9C;;;;;OAKG;IACH,WAAW,IAAI,OAAO;IAItB;;;;;OAKG;IACH,WAAW,IAAI,OAAO;IAYtB;;;;;OAKG;IACH,WAAW,IAAI,OAAO;IAItB;;;;;OAKG;IACH,GAAG,IAAI,OAAO;IAId;;;;;OAKG;IACH,QAAQ,IAAI,OAAO;IAInB;;;;;OAKG;IACH,MAAM,IAAI,OAAO;IAIjB;;;;;OAKG;IACH,UAAU,IAAI,OAAO;IAMrB;;OAEG;IACH,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAU5C;;OAEG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM;IAmC7E;;;OAGG;IACH,KAAK,IAAI,MAAM;IA8Cf;;;;;;;OAOG;IACH,uBAAuB,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,GAAE,OAAe,GAAG,MAAM;IAgDjF;;;;;;;OAOG;IACH,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,GAAE,OAAe,GAAG,MAAM;CAI5E"}
|
||||
998
BACK_BACK/node_modules/ip-address/dist/ipv6.js
generated
vendored
Executable file
998
BACK_BACK/node_modules/ip-address/dist/ipv6.js
generated
vendored
Executable file
|
|
@ -0,0 +1,998 @@
|
|||
"use strict";
|
||||
/* eslint-disable prefer-destructuring */
|
||||
/* 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.Address6 = void 0;
|
||||
const common = __importStar(require("./common"));
|
||||
const constants4 = __importStar(require("./v4/constants"));
|
||||
const constants6 = __importStar(require("./v6/constants"));
|
||||
const helpers = __importStar(require("./v6/helpers"));
|
||||
const ipv4_1 = require("./ipv4");
|
||||
const regular_expressions_1 = require("./v6/regular-expressions");
|
||||
const address_error_1 = require("./address-error");
|
||||
const jsbn_1 = require("jsbn");
|
||||
const sprintf_js_1 = require("sprintf-js");
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw new Error('Assertion failed.');
|
||||
}
|
||||
}
|
||||
function addCommas(number) {
|
||||
const r = /(\d+)(\d{3})/;
|
||||
while (r.test(number)) {
|
||||
number = number.replace(r, '$1,$2');
|
||||
}
|
||||
return number;
|
||||
}
|
||||
function spanLeadingZeroes4(n) {
|
||||
n = n.replace(/^(0{1,})([1-9]+)$/, '<span class="parse-error">$1</span>$2');
|
||||
n = n.replace(/^(0{1,})(0)$/, '<span class="parse-error">$1</span>$2');
|
||||
return n;
|
||||
}
|
||||
/*
|
||||
* A helper function to compact an array
|
||||
*/
|
||||
function compact(address, slice) {
|
||||
const s1 = [];
|
||||
const s2 = [];
|
||||
let i;
|
||||
for (i = 0; i < address.length; i++) {
|
||||
if (i < slice[0]) {
|
||||
s1.push(address[i]);
|
||||
}
|
||||
else if (i > slice[1]) {
|
||||
s2.push(address[i]);
|
||||
}
|
||||
}
|
||||
return s1.concat(['compact']).concat(s2);
|
||||
}
|
||||
function paddedHex(octet) {
|
||||
return (0, sprintf_js_1.sprintf)('%04x', parseInt(octet, 16));
|
||||
}
|
||||
function unsignByte(b) {
|
||||
// eslint-disable-next-line no-bitwise
|
||||
return b & 0xff;
|
||||
}
|
||||
/**
|
||||
* Represents an IPv6 address
|
||||
* @class Address6
|
||||
* @param {string} address - An IPv6 address string
|
||||
* @param {number} [groups=8] - How many octets to parse
|
||||
* @example
|
||||
* var address = new Address6('2001::/32');
|
||||
*/
|
||||
class Address6 {
|
||||
constructor(address, optionalGroups) {
|
||||
this.addressMinusSuffix = '';
|
||||
this.parsedSubnet = '';
|
||||
this.subnet = '/128';
|
||||
this.subnetMask = 128;
|
||||
this.v4 = false;
|
||||
this.zone = '';
|
||||
// #region Attributes
|
||||
/**
|
||||
* Returns true if the given address is in the subnet of the current address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
this.isInSubnet = common.isInSubnet;
|
||||
/**
|
||||
* Returns true if the address is correct, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
this.isCorrect = common.isCorrect(constants6.BITS);
|
||||
if (optionalGroups === undefined) {
|
||||
this.groups = constants6.GROUPS;
|
||||
}
|
||||
else {
|
||||
this.groups = optionalGroups;
|
||||
}
|
||||
this.address = address;
|
||||
const subnet = constants6.RE_SUBNET_STRING.exec(address);
|
||||
if (subnet) {
|
||||
this.parsedSubnet = subnet[0].replace('/', '');
|
||||
this.subnetMask = parseInt(this.parsedSubnet, 10);
|
||||
this.subnet = `/${this.subnetMask}`;
|
||||
if (Number.isNaN(this.subnetMask) ||
|
||||
this.subnetMask < 0 ||
|
||||
this.subnetMask > constants6.BITS) {
|
||||
throw new address_error_1.AddressError('Invalid subnet mask.');
|
||||
}
|
||||
address = address.replace(constants6.RE_SUBNET_STRING, '');
|
||||
}
|
||||
else if (/\//.test(address)) {
|
||||
throw new address_error_1.AddressError('Invalid subnet mask.');
|
||||
}
|
||||
const zone = constants6.RE_ZONE_STRING.exec(address);
|
||||
if (zone) {
|
||||
this.zone = zone[0];
|
||||
address = address.replace(constants6.RE_ZONE_STRING, '');
|
||||
}
|
||||
this.addressMinusSuffix = address;
|
||||
this.parsedAddress = this.parse(this.addressMinusSuffix);
|
||||
}
|
||||
static isValid(address) {
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
new Address6(address);
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Convert a BigInteger to a v6 address object
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @param {BigInteger} bigInteger - a BigInteger to convert
|
||||
* @returns {Address6}
|
||||
* @example
|
||||
* var bigInteger = new BigInteger('1000000000000');
|
||||
* var address = Address6.fromBigInteger(bigInteger);
|
||||
* address.correctForm(); // '::e8:d4a5:1000'
|
||||
*/
|
||||
static fromBigInteger(bigInteger) {
|
||||
const hex = bigInteger.toString(16).padStart(32, '0');
|
||||
const groups = [];
|
||||
let i;
|
||||
for (i = 0; i < constants6.GROUPS; i++) {
|
||||
groups.push(hex.slice(i * 4, (i + 1) * 4));
|
||||
}
|
||||
return new Address6(groups.join(':'));
|
||||
}
|
||||
/**
|
||||
* Convert a URL (with optional port number) to an address object
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @param {string} url - a URL with optional port number
|
||||
* @example
|
||||
* var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/');
|
||||
* addressAndPort.address.correctForm(); // 'ffff::'
|
||||
* addressAndPort.port; // 8080
|
||||
*/
|
||||
static fromURL(url) {
|
||||
let host;
|
||||
let port = null;
|
||||
let result;
|
||||
// If we have brackets parse them and find a port
|
||||
if (url.indexOf('[') !== -1 && url.indexOf(']:') !== -1) {
|
||||
result = constants6.RE_URL_WITH_PORT.exec(url);
|
||||
if (result === null) {
|
||||
return {
|
||||
error: 'failed to parse address with port',
|
||||
address: null,
|
||||
port: null,
|
||||
};
|
||||
}
|
||||
host = result[1];
|
||||
port = result[2];
|
||||
// If there's a URL extract the address
|
||||
}
|
||||
else if (url.indexOf('/') !== -1) {
|
||||
// Remove the protocol prefix
|
||||
url = url.replace(/^[a-z0-9]+:\/\//, '');
|
||||
// Parse the address
|
||||
result = constants6.RE_URL.exec(url);
|
||||
if (result === null) {
|
||||
return {
|
||||
error: 'failed to parse address from URL',
|
||||
address: null,
|
||||
port: null,
|
||||
};
|
||||
}
|
||||
host = result[1];
|
||||
// Otherwise just assign the URL to the host and let the library parse it
|
||||
}
|
||||
else {
|
||||
host = url;
|
||||
}
|
||||
// If there's a port convert it to an integer
|
||||
if (port) {
|
||||
port = parseInt(port, 10);
|
||||
// squelch out of range ports
|
||||
if (port < 0 || port > 65536) {
|
||||
port = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Standardize `undefined` to `null`
|
||||
port = null;
|
||||
}
|
||||
return {
|
||||
address: new Address6(host),
|
||||
port,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Create an IPv6-mapped address given an IPv4 address
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @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) {
|
||||
const address4 = new ipv4_1.Address4(address);
|
||||
const mask6 = constants6.BITS - (constants4.BITS - address4.subnetMask);
|
||||
return new Address6(`::ffff:${address4.correctForm()}/${mask6}`);
|
||||
}
|
||||
/**
|
||||
* Return an address from ip6.arpa form
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @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) {
|
||||
// remove ending ".ip6.arpa." or just "."
|
||||
let address = arpaFormAddress.replace(/(\.ip6\.arpa)?\.$/, '');
|
||||
const semicolonAmount = 7;
|
||||
// correct ip6.arpa form with ending removed will be 63 characters
|
||||
if (address.length !== 63) {
|
||||
throw new address_error_1.AddressError("Invalid 'ip6.arpa' form.");
|
||||
}
|
||||
const parts = address.split('.').reverse();
|
||||
for (let i = semicolonAmount; i > 0; i--) {
|
||||
const insertIndex = i * 4;
|
||||
parts.splice(insertIndex, 0, ':');
|
||||
}
|
||||
address = parts.join('');
|
||||
return new Address6(address);
|
||||
}
|
||||
/**
|
||||
* Return the Microsoft UNC transcription of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String} the Microsoft UNC transcription of the address
|
||||
*/
|
||||
microsoftTranscription() {
|
||||
return (0, sprintf_js_1.sprintf)('%s.ipv6-literal.net', this.correctForm().replace(/:/g, '-'));
|
||||
}
|
||||
/**
|
||||
* Return the first n bits of the address, defaulting to the subnet mask
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @param {number} [mask=subnet] - the number of bits to mask
|
||||
* @returns {String} the first n bits of the address as a string
|
||||
*/
|
||||
mask(mask = this.subnetMask) {
|
||||
return this.getBitsBase2(0, mask);
|
||||
}
|
||||
/**
|
||||
* Return the number of possible subnets of a given size in the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @param {number} [size=128] - the subnet size
|
||||
* @returns {String}
|
||||
*/
|
||||
// TODO: probably useful to have a numeric version of this too
|
||||
possibleSubnets(subnetSize = 128) {
|
||||
const availableBits = constants6.BITS - this.subnetMask;
|
||||
const subnetBits = Math.abs(subnetSize - constants6.BITS);
|
||||
const subnetPowers = availableBits - subnetBits;
|
||||
if (subnetPowers < 0) {
|
||||
return '0';
|
||||
}
|
||||
return addCommas(new jsbn_1.BigInteger('2', 10).pow(subnetPowers).toString(10));
|
||||
}
|
||||
/**
|
||||
* Helper function getting start address.
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
_startAddress() {
|
||||
return new jsbn_1.BigInteger(this.mask() + '0'.repeat(constants6.BITS - this.subnetMask), 2);
|
||||
}
|
||||
/**
|
||||
* The first address in the range given by this address' subnet
|
||||
* Often referred to as the Network Address.
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Address6}
|
||||
*/
|
||||
startAddress() {
|
||||
return Address6.fromBigInteger(this._startAddress());
|
||||
}
|
||||
/**
|
||||
* The first host address in the range given by this address's subnet ie
|
||||
* the first address after the Network Address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Address6}
|
||||
*/
|
||||
startAddressExclusive() {
|
||||
const adjust = new jsbn_1.BigInteger('1');
|
||||
return Address6.fromBigInteger(this._startAddress().add(adjust));
|
||||
}
|
||||
/**
|
||||
* Helper function getting end address.
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
_endAddress() {
|
||||
return new jsbn_1.BigInteger(this.mask() + '1'.repeat(constants6.BITS - this.subnetMask), 2);
|
||||
}
|
||||
/**
|
||||
* The last address in the range given by this address' subnet
|
||||
* Often referred to as the Broadcast
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Address6}
|
||||
*/
|
||||
endAddress() {
|
||||
return Address6.fromBigInteger(this._endAddress());
|
||||
}
|
||||
/**
|
||||
* The last host address in the range given by this address's subnet ie
|
||||
* the last address prior to the Broadcast Address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Address6}
|
||||
*/
|
||||
endAddressExclusive() {
|
||||
const adjust = new jsbn_1.BigInteger('1');
|
||||
return Address6.fromBigInteger(this._endAddress().subtract(adjust));
|
||||
}
|
||||
/**
|
||||
* Return the scope of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
getScope() {
|
||||
let scope = constants6.SCOPES[this.getBits(12, 16).intValue()];
|
||||
if (this.getType() === 'Global unicast' && scope !== 'Link local') {
|
||||
scope = 'Global';
|
||||
}
|
||||
return scope || 'Unknown';
|
||||
}
|
||||
/**
|
||||
* Return the type of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
getType() {
|
||||
for (const subnet of Object.keys(constants6.TYPES)) {
|
||||
if (this.isInSubnet(new Address6(subnet))) {
|
||||
return constants6.TYPES[subnet];
|
||||
}
|
||||
}
|
||||
return 'Global unicast';
|
||||
}
|
||||
/**
|
||||
* Return the bits in the given range as a BigInteger
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
getBits(start, end) {
|
||||
return new jsbn_1.BigInteger(this.getBitsBase2(start, end), 2);
|
||||
}
|
||||
/**
|
||||
* Return the bits in the given range as a base-2 string
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
getBitsBase2(start, end) {
|
||||
return this.binaryZeroPad().slice(start, end);
|
||||
}
|
||||
/**
|
||||
* Return the bits in the given range as a base-16 string
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
getBitsBase16(start, end) {
|
||||
const length = end - start;
|
||||
if (length % 4 !== 0) {
|
||||
throw new Error('Length of bits to retrieve must be divisible by four');
|
||||
}
|
||||
return this.getBits(start, end)
|
||||
.toString(16)
|
||||
.padStart(length / 4, '0');
|
||||
}
|
||||
/**
|
||||
* Return the bits that are set past the subnet mask length
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
getBitsPastSubnet() {
|
||||
return this.getBitsBase2(this.subnetMask, constants6.BITS);
|
||||
}
|
||||
/**
|
||||
* Return the reversed ip6.arpa form of the address
|
||||
* @memberof Address6
|
||||
* @param {Object} options
|
||||
* @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
reverseForm(options) {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
const characters = Math.floor(this.subnetMask / 4);
|
||||
const reversed = this.canonicalForm()
|
||||
.replace(/:/g, '')
|
||||
.split('')
|
||||
.slice(0, characters)
|
||||
.reverse()
|
||||
.join('.');
|
||||
if (characters > 0) {
|
||||
if (options.omitSuffix) {
|
||||
return reversed;
|
||||
}
|
||||
return (0, sprintf_js_1.sprintf)('%s.ip6.arpa.', reversed);
|
||||
}
|
||||
if (options.omitSuffix) {
|
||||
return '';
|
||||
}
|
||||
return 'ip6.arpa.';
|
||||
}
|
||||
/**
|
||||
* Return the correct form of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
correctForm() {
|
||||
let i;
|
||||
let groups = [];
|
||||
let zeroCounter = 0;
|
||||
const zeroes = [];
|
||||
for (i = 0; i < this.parsedAddress.length; i++) {
|
||||
const value = parseInt(this.parsedAddress[i], 16);
|
||||
if (value === 0) {
|
||||
zeroCounter++;
|
||||
}
|
||||
if (value !== 0 && zeroCounter > 0) {
|
||||
if (zeroCounter > 1) {
|
||||
zeroes.push([i - zeroCounter, i - 1]);
|
||||
}
|
||||
zeroCounter = 0;
|
||||
}
|
||||
}
|
||||
// Do we end with a string of zeroes?
|
||||
if (zeroCounter > 1) {
|
||||
zeroes.push([this.parsedAddress.length - zeroCounter, this.parsedAddress.length - 1]);
|
||||
}
|
||||
const zeroLengths = zeroes.map((n) => n[1] - n[0] + 1);
|
||||
if (zeroes.length > 0) {
|
||||
const index = zeroLengths.indexOf(Math.max(...zeroLengths));
|
||||
groups = compact(this.parsedAddress, zeroes[index]);
|
||||
}
|
||||
else {
|
||||
groups = this.parsedAddress;
|
||||
}
|
||||
for (i = 0; i < groups.length; i++) {
|
||||
if (groups[i] !== 'compact') {
|
||||
groups[i] = parseInt(groups[i], 16).toString(16);
|
||||
}
|
||||
}
|
||||
let correct = groups.join(':');
|
||||
correct = correct.replace(/^compact$/, '::');
|
||||
correct = correct.replace(/^compact|compact$/, ':');
|
||||
correct = correct.replace(/compact/, '');
|
||||
return correct;
|
||||
}
|
||||
/**
|
||||
* Return a zero-padded base-2 string representation of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
* @example
|
||||
* var address = new Address6('2001:4860:4001:803::1011');
|
||||
* address.binaryZeroPad();
|
||||
* // '0010000000000001010010000110000001000000000000010000100000000011
|
||||
* // 0000000000000000000000000000000000000000000000000001000000010001'
|
||||
*/
|
||||
binaryZeroPad() {
|
||||
return this.bigInteger().toString(2).padStart(constants6.BITS, '0');
|
||||
}
|
||||
// TODO: Improve the semantics of this helper function
|
||||
parse4in6(address) {
|
||||
const groups = address.split(':');
|
||||
const lastGroup = groups.slice(-1)[0];
|
||||
const address4 = lastGroup.match(constants4.RE_ADDRESS);
|
||||
if (address4) {
|
||||
this.parsedAddress4 = address4[0];
|
||||
this.address4 = new ipv4_1.Address4(this.parsedAddress4);
|
||||
for (let i = 0; i < this.address4.groups; i++) {
|
||||
if (/^0[0-9]+/.test(this.address4.parsedAddress[i])) {
|
||||
throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.", address.replace(constants4.RE_ADDRESS, this.address4.parsedAddress.map(spanLeadingZeroes4).join('.')));
|
||||
}
|
||||
}
|
||||
this.v4 = true;
|
||||
groups[groups.length - 1] = this.address4.toGroup6();
|
||||
address = groups.join(':');
|
||||
}
|
||||
return address;
|
||||
}
|
||||
// TODO: Make private?
|
||||
parse(address) {
|
||||
address = this.parse4in6(address);
|
||||
const badCharacters = address.match(constants6.RE_BAD_CHARACTERS);
|
||||
if (badCharacters) {
|
||||
throw new address_error_1.AddressError((0, sprintf_js_1.sprintf)('Bad character%s detected in address: %s', badCharacters.length > 1 ? 's' : '', badCharacters.join('')), address.replace(constants6.RE_BAD_CHARACTERS, '<span class="parse-error">$1</span>'));
|
||||
}
|
||||
const badAddress = address.match(constants6.RE_BAD_ADDRESS);
|
||||
if (badAddress) {
|
||||
throw new address_error_1.AddressError((0, sprintf_js_1.sprintf)('Address failed regex: %s', badAddress.join('')), address.replace(constants6.RE_BAD_ADDRESS, '<span class="parse-error">$1</span>'));
|
||||
}
|
||||
let groups = [];
|
||||
const halves = address.split('::');
|
||||
if (halves.length === 2) {
|
||||
let first = halves[0].split(':');
|
||||
let last = halves[1].split(':');
|
||||
if (first.length === 1 && first[0] === '') {
|
||||
first = [];
|
||||
}
|
||||
if (last.length === 1 && last[0] === '') {
|
||||
last = [];
|
||||
}
|
||||
const remaining = this.groups - (first.length + last.length);
|
||||
if (!remaining) {
|
||||
throw new address_error_1.AddressError('Error parsing groups');
|
||||
}
|
||||
this.elidedGroups = remaining;
|
||||
this.elisionBegin = first.length;
|
||||
this.elisionEnd = first.length + this.elidedGroups;
|
||||
groups = groups.concat(first);
|
||||
for (let i = 0; i < remaining; i++) {
|
||||
groups.push('0');
|
||||
}
|
||||
groups = groups.concat(last);
|
||||
}
|
||||
else if (halves.length === 1) {
|
||||
groups = address.split(':');
|
||||
this.elidedGroups = 0;
|
||||
}
|
||||
else {
|
||||
throw new address_error_1.AddressError('Too many :: groups found');
|
||||
}
|
||||
groups = groups.map((group) => (0, sprintf_js_1.sprintf)('%x', parseInt(group, 16)));
|
||||
if (groups.length !== this.groups) {
|
||||
throw new address_error_1.AddressError('Incorrect number of groups found');
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
/**
|
||||
* Return the canonical form of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
canonicalForm() {
|
||||
return this.parsedAddress.map(paddedHex).join(':');
|
||||
}
|
||||
/**
|
||||
* Return the decimal form of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
decimal() {
|
||||
return this.parsedAddress.map((n) => (0, sprintf_js_1.sprintf)('%05d', parseInt(n, 16))).join(':');
|
||||
}
|
||||
/**
|
||||
* Return the address as a BigInteger
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
bigInteger() {
|
||||
return new jsbn_1.BigInteger(this.parsedAddress.map(paddedHex).join(''), 16);
|
||||
}
|
||||
/**
|
||||
* Return the last two groups of this address as an IPv4 address string
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
* @example
|
||||
* var address = new Address6('2001:4860:4001::1825:bf11');
|
||||
* address.to4().correctForm(); // '24.37.191.17'
|
||||
*/
|
||||
to4() {
|
||||
const binary = this.binaryZeroPad().split('');
|
||||
return ipv4_1.Address4.fromHex(new jsbn_1.BigInteger(binary.slice(96, 128).join(''), 2).toString(16));
|
||||
}
|
||||
/**
|
||||
* Return the v4-in-v6 form of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
to4in6() {
|
||||
const address4 = this.to4();
|
||||
const address6 = new Address6(this.parsedAddress.slice(0, 6).join(':'), 6);
|
||||
const correct = address6.correctForm();
|
||||
let infix = '';
|
||||
if (!/:$/.test(correct)) {
|
||||
infix = ':';
|
||||
}
|
||||
return correct + infix + address4.address;
|
||||
}
|
||||
/**
|
||||
* Return an object containing the Teredo properties of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Object}
|
||||
*/
|
||||
inspectTeredo() {
|
||||
/*
|
||||
- Bits 0 to 31 are set to the Teredo prefix (normally 2001:0000::/32).
|
||||
- Bits 32 to 63 embed the primary IPv4 address of the Teredo server that
|
||||
is used.
|
||||
- Bits 64 to 79 can be used to define some flags. Currently only the
|
||||
higher order bit is used; it is set to 1 if the Teredo client is
|
||||
located behind a cone NAT, 0 otherwise. For Microsoft's Windows Vista
|
||||
and Windows Server 2008 implementations, more bits are used. In those
|
||||
implementations, the format for these 16 bits is "CRAAAAUG AAAAAAAA",
|
||||
where "C" remains the "Cone" flag. The "R" bit is reserved for future
|
||||
use. The "U" bit is for the Universal/Local flag (set to 0). The "G" bit
|
||||
is Individual/Group flag (set to 0). The A bits are set to a 12-bit
|
||||
randomly generated number chosen by the Teredo client to introduce
|
||||
additional protection for the Teredo node against IPv6-based scanning
|
||||
attacks.
|
||||
- Bits 80 to 95 contains the obfuscated UDP port number. This is the
|
||||
port number that is mapped by the NAT to the Teredo client with all
|
||||
bits inverted.
|
||||
- Bits 96 to 127 contains the obfuscated IPv4 address. This is the
|
||||
public IPv4 address of the NAT with all bits inverted.
|
||||
*/
|
||||
const prefix = this.getBitsBase16(0, 32);
|
||||
const udpPort = this.getBits(80, 96).xor(new jsbn_1.BigInteger('ffff', 16)).toString();
|
||||
const server4 = ipv4_1.Address4.fromHex(this.getBitsBase16(32, 64));
|
||||
const client4 = ipv4_1.Address4.fromHex(this.getBits(96, 128).xor(new jsbn_1.BigInteger('ffffffff', 16)).toString(16));
|
||||
const flags = this.getBits(64, 80);
|
||||
const flagsBase2 = this.getBitsBase2(64, 80);
|
||||
const coneNat = flags.testBit(15);
|
||||
const reserved = flags.testBit(14);
|
||||
const groupIndividual = flags.testBit(8);
|
||||
const universalLocal = flags.testBit(9);
|
||||
const nonce = new jsbn_1.BigInteger(flagsBase2.slice(2, 6) + flagsBase2.slice(8, 16), 2).toString(10);
|
||||
return {
|
||||
prefix: (0, sprintf_js_1.sprintf)('%s:%s', prefix.slice(0, 4), prefix.slice(4, 8)),
|
||||
server4: server4.address,
|
||||
client4: client4.address,
|
||||
flags: flagsBase2,
|
||||
coneNat,
|
||||
microsoft: {
|
||||
reserved,
|
||||
universalLocal,
|
||||
groupIndividual,
|
||||
nonce,
|
||||
},
|
||||
udpPort,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Return an object containing the 6to4 properties of the address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Object}
|
||||
*/
|
||||
inspect6to4() {
|
||||
/*
|
||||
- Bits 0 to 15 are set to the 6to4 prefix (2002::/16).
|
||||
- Bits 16 to 48 embed the IPv4 address of the 6to4 gateway that is used.
|
||||
*/
|
||||
const prefix = this.getBitsBase16(0, 16);
|
||||
const gateway = ipv4_1.Address4.fromHex(this.getBitsBase16(16, 48));
|
||||
return {
|
||||
prefix: (0, sprintf_js_1.sprintf)('%s', prefix.slice(0, 4)),
|
||||
gateway: gateway.address,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Return a v6 6to4 address from a v6 v4inv6 address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Address6}
|
||||
*/
|
||||
to6to4() {
|
||||
if (!this.is4()) {
|
||||
return null;
|
||||
}
|
||||
const addr6to4 = [
|
||||
'2002',
|
||||
this.getBitsBase16(96, 112),
|
||||
this.getBitsBase16(112, 128),
|
||||
'',
|
||||
'/16',
|
||||
].join(':');
|
||||
return new Address6(addr6to4);
|
||||
}
|
||||
/**
|
||||
* Return a byte array
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Array}
|
||||
*/
|
||||
toByteArray() {
|
||||
const byteArray = this.bigInteger().toByteArray();
|
||||
// work around issue where `toByteArray` returns a leading 0 element
|
||||
if (byteArray.length === 17 && byteArray[0] === 0) {
|
||||
return byteArray.slice(1);
|
||||
}
|
||||
return byteArray;
|
||||
}
|
||||
/**
|
||||
* Return an unsigned byte array
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {Array}
|
||||
*/
|
||||
toUnsignedByteArray() {
|
||||
return this.toByteArray().map(unsignByte);
|
||||
}
|
||||
/**
|
||||
* Convert a byte array to an Address6 object
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @returns {Address6}
|
||||
*/
|
||||
static fromByteArray(bytes) {
|
||||
return this.fromUnsignedByteArray(bytes.map(unsignByte));
|
||||
}
|
||||
/**
|
||||
* Convert an unsigned byte array to an Address6 object
|
||||
* @memberof Address6
|
||||
* @static
|
||||
* @returns {Address6}
|
||||
*/
|
||||
static fromUnsignedByteArray(bytes) {
|
||||
const BYTE_MAX = new jsbn_1.BigInteger('256', 10);
|
||||
let result = new jsbn_1.BigInteger('0', 10);
|
||||
let multiplier = new jsbn_1.BigInteger('1', 10);
|
||||
for (let i = bytes.length - 1; i >= 0; i--) {
|
||||
result = result.add(multiplier.multiply(new jsbn_1.BigInteger(bytes[i].toString(10), 10)));
|
||||
multiplier = multiplier.multiply(BYTE_MAX);
|
||||
}
|
||||
return Address6.fromBigInteger(result);
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is in the canonical form, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isCanonical() {
|
||||
return this.addressMinusSuffix === this.canonicalForm();
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is a link local address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isLinkLocal() {
|
||||
// Zeroes are required, i.e. we can't check isInSubnet with 'fe80::/10'
|
||||
if (this.getBitsBase2(0, 64) ===
|
||||
'1111111010000000000000000000000000000000000000000000000000000000') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is a multicast address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMulticast() {
|
||||
return this.getType() === 'Multicast';
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is a v4-in-v6 address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
is4() {
|
||||
return this.v4;
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is a Teredo address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isTeredo() {
|
||||
return this.isInSubnet(new Address6('2001::/32'));
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is a 6to4 address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
is6to4() {
|
||||
return this.isInSubnet(new Address6('2002::/16'));
|
||||
}
|
||||
/**
|
||||
* Returns true if the address is a loopback address, false otherwise
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isLoopback() {
|
||||
return this.getType() === 'Loopback';
|
||||
}
|
||||
// #endregion
|
||||
// #region HTML
|
||||
/**
|
||||
* @returns {String} the address in link form with a default port of 80
|
||||
*/
|
||||
href(optionalPort) {
|
||||
if (optionalPort === undefined) {
|
||||
optionalPort = '';
|
||||
}
|
||||
else {
|
||||
optionalPort = (0, sprintf_js_1.sprintf)(':%s', optionalPort);
|
||||
}
|
||||
return (0, sprintf_js_1.sprintf)('http://[%s]%s/', this.correctForm(), optionalPort);
|
||||
}
|
||||
/**
|
||||
* @returns {String} a link suitable for conveying the address via a URL hash
|
||||
*/
|
||||
link(options) {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
if (options.className === undefined) {
|
||||
options.className = '';
|
||||
}
|
||||
if (options.prefix === undefined) {
|
||||
options.prefix = '/#address=';
|
||||
}
|
||||
if (options.v4 === undefined) {
|
||||
options.v4 = false;
|
||||
}
|
||||
let formFunction = this.correctForm;
|
||||
if (options.v4) {
|
||||
formFunction = this.to4in6;
|
||||
}
|
||||
if (options.className) {
|
||||
return (0, sprintf_js_1.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>', options.prefix, formFunction.call(this), options.className);
|
||||
}
|
||||
return (0, sprintf_js_1.sprintf)('<a href="%1$s%2$s">%2$s</a>', options.prefix, formFunction.call(this));
|
||||
}
|
||||
/**
|
||||
* Groups an address
|
||||
* @returns {String}
|
||||
*/
|
||||
group() {
|
||||
if (this.elidedGroups === 0) {
|
||||
// The simple case
|
||||
return helpers.simpleGroup(this.address).join(':');
|
||||
}
|
||||
assert(typeof this.elidedGroups === 'number');
|
||||
assert(typeof this.elisionBegin === 'number');
|
||||
// The elided case
|
||||
const output = [];
|
||||
const [left, right] = this.address.split('::');
|
||||
if (left.length) {
|
||||
output.push(...helpers.simpleGroup(left));
|
||||
}
|
||||
else {
|
||||
output.push('');
|
||||
}
|
||||
const classes = ['hover-group'];
|
||||
for (let i = this.elisionBegin; i < this.elisionBegin + this.elidedGroups; i++) {
|
||||
classes.push((0, sprintf_js_1.sprintf)('group-%d', i));
|
||||
}
|
||||
output.push((0, sprintf_js_1.sprintf)('<span class="%s"></span>', classes.join(' ')));
|
||||
if (right.length) {
|
||||
output.push(...helpers.simpleGroup(right, this.elisionEnd));
|
||||
}
|
||||
else {
|
||||
output.push('');
|
||||
}
|
||||
if (this.is4()) {
|
||||
assert(this.address4 instanceof ipv4_1.Address4);
|
||||
output.pop();
|
||||
output.push(this.address4.groupForV6());
|
||||
}
|
||||
return output.join(':');
|
||||
}
|
||||
// #endregion
|
||||
// #region Regular expressions
|
||||
/**
|
||||
* Generate a regular expression string that can be used to find or validate
|
||||
* all variations of this address
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @param {boolean} substringSearch
|
||||
* @returns {string}
|
||||
*/
|
||||
regularExpressionString(substringSearch = false) {
|
||||
let output = [];
|
||||
// TODO: revisit why this is necessary
|
||||
const address6 = new Address6(this.correctForm());
|
||||
if (address6.elidedGroups === 0) {
|
||||
// The simple case
|
||||
output.push((0, regular_expressions_1.simpleRegularExpression)(address6.parsedAddress));
|
||||
}
|
||||
else if (address6.elidedGroups === constants6.GROUPS) {
|
||||
// A completely elided address
|
||||
output.push((0, regular_expressions_1.possibleElisions)(constants6.GROUPS));
|
||||
}
|
||||
else {
|
||||
// A partially elided address
|
||||
const halves = address6.address.split('::');
|
||||
if (halves[0].length) {
|
||||
output.push((0, regular_expressions_1.simpleRegularExpression)(halves[0].split(':')));
|
||||
}
|
||||
assert(typeof address6.elidedGroups === 'number');
|
||||
output.push((0, regular_expressions_1.possibleElisions)(address6.elidedGroups, halves[0].length !== 0, halves[1].length !== 0));
|
||||
if (halves[1].length) {
|
||||
output.push((0, regular_expressions_1.simpleRegularExpression)(halves[1].split(':')));
|
||||
}
|
||||
output = [output.join(':')];
|
||||
}
|
||||
if (!substringSearch) {
|
||||
output = [
|
||||
'(?=^|',
|
||||
regular_expressions_1.ADDRESS_BOUNDARY,
|
||||
'|[^\\w\\:])(',
|
||||
...output,
|
||||
')(?=[^\\w\\:]|',
|
||||
regular_expressions_1.ADDRESS_BOUNDARY,
|
||||
'|$)',
|
||||
];
|
||||
}
|
||||
return output.join('');
|
||||
}
|
||||
/**
|
||||
* Generate a regular expression that can be used to find or validate all
|
||||
* variations of this address.
|
||||
* @memberof Address6
|
||||
* @instance
|
||||
* @param {boolean} substringSearch
|
||||
* @returns {RegExp}
|
||||
*/
|
||||
regularExpression(substringSearch = false) {
|
||||
return new RegExp(this.regularExpressionString(substringSearch), 'i');
|
||||
}
|
||||
}
|
||||
exports.Address6 = Address6;
|
||||
//# sourceMappingURL=ipv6.js.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/ipv6.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/ipv6.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
5
BACK_BACK/node_modules/ip-address/dist/v4/constants.d.ts
generated
vendored
Executable file
5
BACK_BACK/node_modules/ip-address/dist/v4/constants.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
export declare const BITS = 32;
|
||||
export declare const GROUPS = 4;
|
||||
export declare const RE_ADDRESS: RegExp;
|
||||
export declare const RE_SUBNET_STRING: RegExp;
|
||||
//# sourceMappingURL=constants.d.ts.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/v4/constants.d.ts.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/v4/constants.d.ts.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/v4/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,KAAK,CAAC;AACvB,eAAO,MAAM,MAAM,IAAI,CAAC;AAExB,eAAO,MAAM,UAAU,QAAsK,CAAC;AAE9L,eAAO,MAAM,gBAAgB,QAAe,CAAC"}
|
||||
8
BACK_BACK/node_modules/ip-address/dist/v4/constants.js
generated
vendored
Executable file
8
BACK_BACK/node_modules/ip-address/dist/v4/constants.js
generated
vendored
Executable 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
|
||||
1
BACK_BACK/node_modules/ip-address/dist/v4/constants.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/v4/constants.js.map
generated
vendored
Executable 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,GAAG,mKAAmK,CAAC;AAEjL,QAAA,gBAAgB,GAAG,YAAY,CAAC"}
|
||||
45
BACK_BACK/node_modules/ip-address/dist/v6/constants.d.ts
generated
vendored
Executable file
45
BACK_BACK/node_modules/ip-address/dist/v6/constants.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
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;
|
||||
//# sourceMappingURL=constants.d.ts.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/v6/constants.d.ts.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/v6/constants.d.ts.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/v6/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,MAAM,CAAC;AACxB,eAAO,MAAM,MAAM,IAAI,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAS9C,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAuB7C,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAqB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAA6C,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAqB,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAS,CAAC;AAErC,eAAO,MAAM,MAAM,QAA4C,CAAC;AAChE,eAAO,MAAM,gBAAgB,QAA8C,CAAC"}
|
||||
76
BACK_BACK/node_modules/ip-address/dist/v6/constants.js
generated
vendored
Executable file
76
BACK_BACK/node_modules/ip-address/dist/v6/constants.js
generated
vendored
Executable file
|
|
@ -0,0 +1,76 @@
|
|||
"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',
|
||||
};
|
||||
/**
|
||||
* 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 = new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/);
|
||||
exports.RE_URL_WITH_PORT = new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);
|
||||
//# sourceMappingURL=constants.js.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/v6/constants.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/v6/constants.js.map
generated
vendored
Executable 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;CACzB,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,IAAI,MAAM,CAAC,6BAA6B,CAAC,CAAC;AACnD,QAAA,gBAAgB,GAAG,IAAI,MAAM,CAAC,+BAA+B,CAAC,CAAC"}
|
||||
18
BACK_BACK/node_modules/ip-address/dist/v6/helpers.d.ts
generated
vendored
Executable file
18
BACK_BACK/node_modules/ip-address/dist/v6/helpers.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* @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[];
|
||||
//# sourceMappingURL=helpers.d.ts.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/v6/helpers.d.ts.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/v6/helpers.d.ts.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/v6/helpers.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,CAc7D;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,EAAE,CAc/E"}
|
||||
48
BACK_BACK/node_modules/ip-address/dist/v6/helpers.js
generated
vendored
Executable file
48
BACK_BACK/node_modules/ip-address/dist/v6/helpers.js
generated
vendored
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.simpleGroup = exports.spanLeadingZeroes = exports.spanAll = exports.spanAllZeroes = void 0;
|
||||
const sprintf_js_1 = require("sprintf-js");
|
||||
/**
|
||||
* @returns {String} the string with all zeroes contained in a <span>
|
||||
*/
|
||||
function spanAllZeroes(s) {
|
||||
return s.replace(/(0+)/g, '<span class="zero">$1</span>');
|
||||
}
|
||||
exports.spanAllZeroes = spanAllZeroes;
|
||||
/**
|
||||
* @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) => (0, sprintf_js_1.sprintf)('<span class="digit value-%s position-%d">%s</span>', n, i + offset, spanAllZeroes(n)) // XXX Use #base-2 .value-0 instead?
|
||||
)
|
||||
.join('');
|
||||
}
|
||||
exports.spanAll = spanAll;
|
||||
function spanLeadingZeroesSimple(group) {
|
||||
return 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(':');
|
||||
}
|
||||
exports.spanLeadingZeroes = spanLeadingZeroes;
|
||||
/**
|
||||
* 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 (0, sprintf_js_1.sprintf)('<span class="hover-group group-%d">%s</span>', i + offset, spanLeadingZeroesSimple(g));
|
||||
});
|
||||
}
|
||||
exports.simpleGroup = simpleGroup;
|
||||
//# sourceMappingURL=helpers.js.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/v6/helpers.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/v6/helpers.js.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/v6/helpers.ts"],"names":[],"mappings":";;;AAAA,2CAAqC;AAErC;;GAEG;AACH,SAAgB,aAAa,CAAC,CAAS;IACrC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC;AAC5D,CAAC;AAFD,sCAEC;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,IAAA,oBAAO,EACL,oDAAoD,EACpD,CAAC,EACD,CAAC,GAAG,MAAM,EACV,aAAa,CAAC,CAAC,CAAC,CACjB,CAAC,oCAAoC;KACzC;SACA,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAdD,0BAcC;AAED,SAAS,uBAAuB,CAAC,KAAa;IAC5C,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC;AAChE,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;AAJD,8CAIC;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;YACtB,OAAO,CAAC,CAAC;SACV;QAED,OAAO,IAAA,oBAAO,EACZ,8CAA8C,EAC9C,CAAC,GAAG,MAAM,EACV,uBAAuB,CAAC,CAAC,CAAC,CAC3B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAdD,kCAcC"}
|
||||
6
BACK_BACK/node_modules/ip-address/dist/v6/regular-expressions.d.ts
generated
vendored
Executable file
6
BACK_BACK/node_modules/ip-address/dist/v6/regular-expressions.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
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;
|
||||
//# sourceMappingURL=regular-expressions.d.ts.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/v6/regular-expressions.d.ts.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/v6/regular-expressions.d.ts.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"regular-expressions.d.ts","sourceRoot":"","sources":["../../src/v6/regular-expressions.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM,CAElE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM9C;AAED,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,UA+BvD;AAED,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,OAAO,EAClB,SAAS,CAAC,EAAE,OAAO,GAClB,MAAM,CA4CR"}
|
||||
96
BACK_BACK/node_modules/ip-address/dist/v6/regular-expressions.js
generated
vendored
Executable file
96
BACK_BACK/node_modules/ip-address/dist/v6/regular-expressions.js
generated
vendored
Executable file
|
|
@ -0,0 +1,96 @@
|
|||
"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.possibleElisions = exports.simpleRegularExpression = exports.ADDRESS_BOUNDARY = exports.padGroup = exports.groupPossibilities = void 0;
|
||||
const v6 = __importStar(require("./constants"));
|
||||
const sprintf_js_1 = require("sprintf-js");
|
||||
function groupPossibilities(possibilities) {
|
||||
return (0, sprintf_js_1.sprintf)('(%s)', possibilities.join('|'));
|
||||
}
|
||||
exports.groupPossibilities = groupPossibilities;
|
||||
function padGroup(group) {
|
||||
if (group.length < 4) {
|
||||
return (0, sprintf_js_1.sprintf)('0{0,%d}%s', 4 - group.length, group);
|
||||
}
|
||||
return group;
|
||||
}
|
||||
exports.padGroup = padGroup;
|
||||
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);
|
||||
}
|
||||
exports.simpleRegularExpression = simpleRegularExpression;
|
||||
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((0, sprintf_js_1.sprintf)('%s(:0{1,4}){1,%d}', left, elidedGroups - 1));
|
||||
// 5. elision from the right side
|
||||
possibilities.push((0, sprintf_js_1.sprintf)('(0{1,4}:){1,%d}%s', elidedGroups - 1, right));
|
||||
// 6. no elision
|
||||
possibilities.push((0, sprintf_js_1.sprintf)('(0{1,4}:){%d}0{1,4}', elidedGroups - 1));
|
||||
// 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, sprintf_js_1.sprintf)('(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}', position, elidedGroups - position - groups - 1));
|
||||
}
|
||||
}
|
||||
return groupPossibilities(possibilities);
|
||||
}
|
||||
exports.possibleElisions = possibleElisions;
|
||||
//# sourceMappingURL=regular-expressions.js.map
|
||||
1
BACK_BACK/node_modules/ip-address/dist/v6/regular-expressions.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/dist/v6/regular-expressions.js.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"regular-expressions.js","sourceRoot":"","sources":["../../src/v6/regular-expressions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,2CAAqC;AAErC,SAAgB,kBAAkB,CAAC,aAAuB;IACxD,OAAO,IAAA,oBAAO,EAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;AAFD,gDAEC;AAED,SAAgB,QAAQ,CAAC,KAAa;IACpC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,OAAO,IAAA,oBAAO,EAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KACtD;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAND,4BAMC;AAEY,QAAA,gBAAgB,GAAG,eAAe,CAAC;AAEhD,SAAgB,uBAAuB,CAAC,MAAgB;IACtD,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QAC1B,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEzC,IAAI,YAAY,KAAK,CAAC,EAAE;YACtB,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;IAEH,6EAA6E;IAC7E,4BAA4B;IAC5B,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAClD,MAAM;SACH,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QAChB,IAAI,CAAC,KAAK,SAAS,EAAE;YACnB,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAE1D,OAAO,kBAAkB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;SACvD;QAED,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CACb,CAAC;IAEF,oBAAoB;IACpB,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEnD,OAAO,kBAAkB,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC;AA/BD,0DA+BC;AAED,SAAgB,gBAAgB,CAC9B,YAAoB,EACpB,QAAkB,EAClB,SAAmB;IAEnB,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACjC,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAEnC,MAAM,aAAa,GAAG,EAAE,CAAC;IAEzB,gCAAgC;IAChC,IAAI,CAAC,QAAQ,IAAI,CAAC,SAAS,EAAE;QAC3B,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC1B;IAED,oCAAoC;IACpC,IAAI,QAAQ,IAAI,SAAS,EAAE;QACzB,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KACxB;IAED,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,IAAI,QAAQ,CAAC,EAAE;QACxD,kCAAkC;QAClC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACzB;IAED,gCAAgC;IAChC,aAAa,CAAC,IAAI,CAAC,IAAA,oBAAO,EAAC,mBAAmB,EAAE,IAAI,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC;IAEzE,iCAAiC;IACjC,aAAa,CAAC,IAAI,CAAC,IAAA,oBAAO,EAAC,mBAAmB,EAAE,YAAY,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAE1E,gBAAgB;IAChB,aAAa,CAAC,IAAI,CAAC,IAAA,oBAAO,EAAC,qBAAqB,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC;IAErE,wDAAwD;IACxD,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE;QACxD,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,MAAM,EAAE,QAAQ,EAAE,EAAE;YACnE,aAAa,CAAC,IAAI,CAChB,IAAA,oBAAO,EACL,mCAAmC,EACnC,QAAQ,EACR,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,CAAC,CACrC,CACF,CAAC;SACH;KACF;IAED,OAAO,kBAAkB,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC;AAhDD,4CAgDC"}
|
||||
26
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/CONTRIBUTORS.md
generated
vendored
Executable file
26
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/CONTRIBUTORS.md
generated
vendored
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
Alexander Rose [@arose](https://github.com/arose)
|
||||
Alexandru Mărășteanu [@alexei](https://github.com/alexei)
|
||||
Andras [@andrasq](https://github.com/andrasq)
|
||||
Benoit Giannangeli [@giann](https://github.com/giann)
|
||||
Branden Visser [@mrvisser](https://github.com/mrvisser)
|
||||
David Baird
|
||||
daurnimator [@daurnimator](https://github.com/daurnimator)
|
||||
Doug Beck [@beck](https://github.com/beck)
|
||||
Dzmitry Litskalau [@litmit](https://github.com/litmit)
|
||||
Fred Ludlow [@fredludlow](https://github.com/fredludlow)
|
||||
Hans Pufal
|
||||
Henry [@alograg](https://github.com/alograg)
|
||||
Johnny Shields [@johnnyshields](https://github.com/johnnyshields)
|
||||
Kamal Abdali
|
||||
Matt Simerson [@msimerson](https://github.com/msimerson)
|
||||
Maxime Robert [@marob](https://github.com/marob)
|
||||
MeriemKhelifi [@MeriemKhelifi](https://github.com/MeriemKhelifi)
|
||||
Michael Schramm [@wodka](https://github.com/wodka)
|
||||
Nazar Mokrynskyi [@nazar-pc](https://github.com/nazar-pc)
|
||||
Oliver Salzburg [@oliversalzburg](https://github.com/oliversalzburg)
|
||||
Pablo [@ppollono](https://github.com/ppollono)
|
||||
Rabehaja Stevens [@RABEHAJA-STEVENS](https://github.com/RABEHAJA-STEVENS)
|
||||
Raphael Pigulla [@pigulla](https://github.com/pigulla)
|
||||
rebeccapeltz [@rebeccapeltz](https://github.com/rebeccapeltz)
|
||||
Stefan Tingström [@stingstrom](https://github.com/stingstrom)
|
||||
Tim Gates [@timgates42](https://github.com/timgates42)
|
||||
24
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/LICENSE
generated
vendored
Executable file
24
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
Copyright (c) 2007-present, Alexandru Mărășteanu <hello@alexei.ro>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of this software nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
143
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/README.md
generated
vendored
Executable file
143
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,143 @@
|
|||
# sprintf-js
|
||||
|
||||
[![Build Status][travisci-image]][travisci-url] [![NPM Version][npm-image]][npm-url] [![Dependency Status][dependencies-image]][dependencies-url] [![devDependency Status][dev-dependencies-image]][dev-dependencies-url]
|
||||
|
||||
[travisci-image]: https://travis-ci.org/alexei/sprintf.js.svg?branch=master
|
||||
[travisci-url]: https://travis-ci.org/alexei/sprintf.js
|
||||
|
||||
[npm-image]: https://badge.fury.io/js/sprintf-js.svg
|
||||
[npm-url]: https://badge.fury.io/js/sprintf-js
|
||||
|
||||
[dependencies-image]: https://david-dm.org/alexei/sprintf.js.svg
|
||||
[dependencies-url]: https://david-dm.org/alexei/sprintf.js
|
||||
|
||||
[dev-dependencies-image]: https://david-dm.org/alexei/sprintf.js/dev-status.svg
|
||||
[dev-dependencies-url]: https://david-dm.org/alexei/sprintf.js#info=devDependencies
|
||||
|
||||
**sprintf-js** is a complete open source JavaScript `sprintf` implementation for the **browser** and **Node.js**.
|
||||
|
||||
**Note: as of v1.1.1 you might need some polyfills for older environments. See [Support](#support) section below.**
|
||||
|
||||
## Usage
|
||||
|
||||
var sprintf = require('sprintf-js').sprintf,
|
||||
vsprintf = require('sprintf-js').vsprintf
|
||||
|
||||
sprintf('%2$s %3$s a %1$s', 'cracker', 'Polly', 'wants')
|
||||
vsprintf('The first 4 letters of the english alphabet are: %s, %s, %s and %s', ['a', 'b', 'c', 'd'])
|
||||
|
||||
## Installation
|
||||
|
||||
### NPM
|
||||
|
||||
npm install sprintf-js
|
||||
|
||||
### Bower
|
||||
|
||||
bower install sprintf
|
||||
|
||||
## API
|
||||
|
||||
### `sprintf`
|
||||
|
||||
Returns a formatted string:
|
||||
|
||||
string sprintf(string format, mixed arg1?, mixed arg2?, ...)
|
||||
|
||||
### `vsprintf`
|
||||
|
||||
Same as `sprintf` except it takes an array of arguments, rather than a variable number of arguments:
|
||||
|
||||
string vsprintf(string format, array arguments?)
|
||||
|
||||
## Format specification
|
||||
|
||||
The placeholders in the format string are marked by `%` and are followed by one or more of these elements, in this order:
|
||||
|
||||
* An optional number followed by a `$` sign that selects which argument index to use for the value. If not specified, arguments will be placed in the same order as the placeholders in the input string.
|
||||
* An optional `+` sign that forces to precede the result with a plus or minus sign on numeric values. By default, only the `-` sign is used on negative numbers.
|
||||
* An optional padding specifier that says what character to use for padding (if specified). Possible values are `0` or any other character preceded by a `'` (single quote). The default is to pad with *spaces*.
|
||||
* An optional `-` sign, that causes `sprintf` to left-align the result of this placeholder. The default is to right-align the result.
|
||||
* An optional number, that says how many characters the result should have. If the value to be returned is shorter than this number, the result will be padded. When used with the `j` (JSON) type specifier, the padding length specifies the tab size used for indentation.
|
||||
* An optional precision modifier, consisting of a `.` (dot) followed by a number, that says how many digits should be displayed for floating point numbers. When used with the `g` type specifier, it specifies the number of significant digits. When used on a string, it causes the result to be truncated.
|
||||
* A type specifier that can be any of:
|
||||
* `%` — yields a literal `%` character
|
||||
* `b` — yields an integer as a binary number
|
||||
* `c` — yields an integer as the character with that ASCII value
|
||||
* `d` or `i` — yields an integer as a signed decimal number
|
||||
* `e` — yields a float using scientific notation
|
||||
* `u` — yields an integer as an unsigned decimal number
|
||||
* `f` — yields a float as is; see notes on precision above
|
||||
* `g` — yields a float as is; see notes on precision above
|
||||
* `o` — yields an integer as an octal number
|
||||
* `s` — yields a string as is
|
||||
* `t` — yields `true` or `false`
|
||||
* `T` — yields the type of the argument<sup><a href="#fn-1" name="fn-ref-1">1</a></sup>
|
||||
* `v` — yields the primitive value of the specified argument
|
||||
* `x` — yields an integer as a hexadecimal number (lower-case)
|
||||
* `X` — yields an integer as a hexadecimal number (upper-case)
|
||||
* `j` — yields a JavaScript object or array as a JSON encoded string
|
||||
|
||||
## Features
|
||||
|
||||
### Argument swapping
|
||||
|
||||
You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. You can do that by simply indicating in the format string which arguments the placeholders refer to:
|
||||
|
||||
sprintf('%2$s %3$s a %1$s', 'cracker', 'Polly', 'wants')
|
||||
|
||||
And, of course, you can repeat the placeholders without having to increase the number of arguments.
|
||||
|
||||
### Named arguments
|
||||
|
||||
Format strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - `(` and `)` - and begin with a keyword that refers to a key:
|
||||
|
||||
var user = {
|
||||
name: 'Dolly',
|
||||
}
|
||||
sprintf('Hello %(name)s', user) // Hello Dolly
|
||||
|
||||
Keywords in replacement fields can be optionally followed by any number of keywords or indexes:
|
||||
|
||||
var users = [
|
||||
{name: 'Dolly'},
|
||||
{name: 'Molly'},
|
||||
{name: 'Polly'},
|
||||
]
|
||||
sprintf('Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s', {users: users}) // Hello Dolly, Molly and Polly
|
||||
|
||||
Note: mixing positional and named placeholders is not (yet) supported
|
||||
|
||||
### Computed values
|
||||
|
||||
You can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on the fly.
|
||||
|
||||
sprintf('Current date and time: %s', function() { return new Date().toString() })
|
||||
|
||||
### AngularJS
|
||||
|
||||
You can use `sprintf` and `vsprintf` (also aliased as `fmt` and `vfmt` respectively) in your AngularJS projects. See `demo/`.
|
||||
|
||||
## Support
|
||||
|
||||
### Node.js
|
||||
|
||||
`sprintf-js` runs in all active Node versions (4.x+).
|
||||
|
||||
### Browser
|
||||
|
||||
`sprintf-js` should work in all modern browsers. As of v1.1.1, you might need polyfills for the following:
|
||||
|
||||
- `String.prototype.repeat()` (any IE)
|
||||
- `Array.isArray()` (IE < 9)
|
||||
- `Object.create()` (IE < 9)
|
||||
|
||||
YMMV
|
||||
|
||||
## License
|
||||
|
||||
**sprintf-js** is licensed under the terms of the BSD 3-Clause License.
|
||||
|
||||
## Notes
|
||||
|
||||
<small><sup><a href="#fn-ref-1" name="fn-1">1</a></sup> `sprintf` doesn't use the `typeof` operator. As such, the value `null` is a `null`, an array is an `array` (not an `object`), a date value is a `date` etc.</small>
|
||||
4
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/dist/.gitattributes
generated
vendored
Executable file
4
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/dist/.gitattributes
generated
vendored
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#ignore all generated files from diff
|
||||
#also skip line ending check
|
||||
*.js -diff -text
|
||||
*.map -diff -text
|
||||
3
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/dist/angular-sprintf.min.js
generated
vendored
Executable file
3
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/dist/angular-sprintf.min.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
/*! sprintf-js v1.1.3 | Copyright (c) 2007-present, Alexandru Mărășteanu <hello@alexei.ro> | BSD-3-Clause */
|
||||
!function(){"use strict";angular.module("sprintf",[]).filter("sprintf",function(){return function(){return sprintf.apply(null,arguments)}}).filter("fmt",["$filter",function(t){return t("sprintf")}]).filter("vsprintf",function(){return function(t,n){return vsprintf(t,n)}}).filter("vfmt",["$filter",function(t){return t("vsprintf")}])}();
|
||||
//# sourceMappingURL=angular-sprintf.min.js.map
|
||||
1
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/dist/angular-sprintf.min.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/dist/angular-sprintf.min.js.map
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";CAEC,WACG,aAEAA,QACIC,OAAO,UAAW,IAClBC,OAAO,UAAW,WACd,OAAO,WACH,OAAOC,QAAQC,MAAM,KAAMC,cAGnCH,OAAO,MAAO,CAAC,UAAW,SAASI,GAC/B,OAAOA,EAAQ,cAEnBJ,OAAO,WAAY,WACf,OAAO,SAASK,EAAQC,GACpB,OAAOC,SAASF,EAAQC,MAGhCN,OAAO,OAAQ,CAAC,UAAW,SAASI,GAChC,OAAOA,EAAQ,eAnB1B","file":"angular-sprintf.min.js","sourcesContent":["/* global angular, sprintf, vsprintf */\n\n!function() {\n 'use strict'\n\n angular.\n module('sprintf', []).\n filter('sprintf', function() {\n return function() {\n return sprintf.apply(null, arguments)\n }\n }).\n filter('fmt', ['$filter', function($filter) {\n return $filter('sprintf')\n }]).\n filter('vsprintf', function() {\n return function(format, argv) {\n return vsprintf(format, argv)\n }\n }).\n filter('vfmt', ['$filter', function($filter) {\n return $filter('vsprintf')\n }])\n}(); // eslint-disable-line\n"]}
|
||||
3
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/dist/sprintf.min.js
generated
vendored
Executable file
3
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/dist/sprintf.min.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
/*! sprintf-js v1.1.3 | Copyright (c) 2007-present, Alexandru Mărășteanu <hello@alexei.ro> | BSD-3-Clause */
|
||||
!function(){"use strict";var g={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function y(e){return function(e,t){var r,n,i,s,a,o,p,c,l,u=1,f=e.length,d="";for(n=0;n<f;n++)if("string"==typeof e[n])d+=e[n];else if("object"==typeof e[n]){if((s=e[n]).keys)for(r=t[u],i=0;i<s.keys.length;i++){if(null==r)throw new Error(y('[sprintf] Cannot access property "%s" of undefined value "%s"',s.keys[i],s.keys[i-1]));r=r[s.keys[i]]}else r=s.param_no?t[s.param_no]:t[u++];if(g.not_type.test(s.type)&&g.not_primitive.test(s.type)&&r instanceof Function&&(r=r()),g.numeric_arg.test(s.type)&&"number"!=typeof r&&isNaN(r))throw new TypeError(y("[sprintf] expecting number but found %T",r));switch(g.number.test(s.type)&&(c=0<=r),s.type){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=JSON.stringify(r,null,s.width?parseInt(s.width):0);break;case"e":r=s.precision?parseFloat(r).toExponential(s.precision):parseFloat(r).toExponential();break;case"f":r=s.precision?parseFloat(r).toFixed(s.precision):parseFloat(r);break;case"g":r=s.precision?String(Number(r.toPrecision(s.precision))):parseFloat(r);break;case"o":r=(parseInt(r,10)>>>0).toString(8);break;case"s":r=String(r),r=s.precision?r.substring(0,s.precision):r;break;case"t":r=String(!!r),r=s.precision?r.substring(0,s.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=s.precision?r.substring(0,s.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=s.precision?r.substring(0,s.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}g.json.test(s.type)?d+=r:(!g.number.test(s.type)||c&&!s.sign?l="":(l=c?"+":"-",r=r.toString().replace(g.sign,"")),o=s.pad_char?"0"===s.pad_char?"0":s.pad_char.charAt(1):" ",p=s.width-(l+r).length,a=s.width&&0<p?o.repeat(p):"",d+=s.align?l+r+a:"0"===o?l+a+r:a+l+r)}return d}(function(e){if(p[e])return p[e];var t,r=e,n=[],i=0;for(;r;){if(null!==(t=g.text.exec(r)))n.push(t[0]);else if(null!==(t=g.modulo.exec(r)))n.push("%");else{if(null===(t=g.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){i|=1;var s=[],a=t[2],o=[];if(null===(o=g.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(o[1]);""!==(a=a.substring(o[0].length));)if(null!==(o=g.key_access.exec(a)))s.push(o[1]);else{if(null===(o=g.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(o[1])}t[2]=s}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}r=r.substring(t[0].length)}return p[e]=n}(e),arguments)}function e(e,t){return y.apply(null,[e].concat(t||[]))}var p=Object.create(null);"undefined"!=typeof exports&&(exports.sprintf=y,exports.vsprintf=e),"undefined"!=typeof window&&(window.sprintf=y,window.vsprintf=e,"function"==typeof define&&define.amd&&define(function(){return{sprintf:y,vsprintf:e}}))}();
|
||||
//# sourceMappingURL=sprintf.min.js.map
|
||||
1
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/dist/sprintf.min.js.map
generated
vendored
Executable file
1
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/dist/sprintf.min.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
35
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/package.json
generated
vendored
Executable file
35
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "sprintf-js",
|
||||
"version": "1.1.3",
|
||||
"description": "JavaScript sprintf implementation",
|
||||
"author": "Alexandru Mărășteanu <hello@alexei.ro>",
|
||||
"main": "src/sprintf.js",
|
||||
"scripts": {
|
||||
"test": "mocha test/*.js",
|
||||
"pretest": "npm run lint",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint --fix ."
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alexei/sprintf.js.git"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"readmeFilename": "README.md",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.4",
|
||||
"eslint": "^5.10.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-benchmark": "^1.1.1",
|
||||
"gulp-eslint": "^5.0.0",
|
||||
"gulp-header": "^2.0.5",
|
||||
"gulp-mocha": "^6.0.0",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"gulp-sourcemaps": "^2.6.4",
|
||||
"gulp-uglify": "^3.0.1",
|
||||
"mocha": "^5.2.0"
|
||||
},
|
||||
"overrides": {
|
||||
"graceful-fs": "^4.2.11"
|
||||
}
|
||||
}
|
||||
24
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/src/angular-sprintf.js
generated
vendored
Executable file
24
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/src/angular-sprintf.js
generated
vendored
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
/* global angular, sprintf, vsprintf */
|
||||
|
||||
!function() {
|
||||
'use strict'
|
||||
|
||||
angular.
|
||||
module('sprintf', []).
|
||||
filter('sprintf', function() {
|
||||
return function() {
|
||||
return sprintf.apply(null, arguments)
|
||||
}
|
||||
}).
|
||||
filter('fmt', ['$filter', function($filter) {
|
||||
return $filter('sprintf')
|
||||
}]).
|
||||
filter('vsprintf', function() {
|
||||
return function(format, argv) {
|
||||
return vsprintf(format, argv)
|
||||
}
|
||||
}).
|
||||
filter('vfmt', ['$filter', function($filter) {
|
||||
return $filter('vsprintf')
|
||||
}])
|
||||
}(); // eslint-disable-line
|
||||
231
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/src/sprintf.js
generated
vendored
Executable file
231
BACK_BACK/node_modules/ip-address/node_modules/sprintf-js/src/sprintf.js
generated
vendored
Executable file
|
|
@ -0,0 +1,231 @@
|
|||
/* global window, exports, define */
|
||||
|
||||
!function() {
|
||||
'use strict'
|
||||
|
||||
var re = {
|
||||
not_string: /[^s]/,
|
||||
not_bool: /[^t]/,
|
||||
not_type: /[^T]/,
|
||||
not_primitive: /[^v]/,
|
||||
number: /[diefg]/,
|
||||
numeric_arg: /[bcdiefguxX]/,
|
||||
json: /[j]/,
|
||||
not_json: /[^j]/,
|
||||
text: /^[^\x25]+/,
|
||||
modulo: /^\x25{2}/,
|
||||
placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,
|
||||
key: /^([a-z_][a-z_\d]*)/i,
|
||||
key_access: /^\.([a-z_][a-z_\d]*)/i,
|
||||
index_access: /^\[(\d+)\]/,
|
||||
sign: /^[+-]/
|
||||
}
|
||||
|
||||
function sprintf(key) {
|
||||
// `arguments` is not an array, but should be fine for this call
|
||||
return sprintf_format(sprintf_parse(key), arguments)
|
||||
}
|
||||
|
||||
function vsprintf(fmt, argv) {
|
||||
return sprintf.apply(null, [fmt].concat(argv || []))
|
||||
}
|
||||
|
||||
function sprintf_format(parse_tree, argv) {
|
||||
var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign
|
||||
for (i = 0; i < tree_length; i++) {
|
||||
if (typeof parse_tree[i] === 'string') {
|
||||
output += parse_tree[i]
|
||||
}
|
||||
else if (typeof parse_tree[i] === 'object') {
|
||||
ph = parse_tree[i] // convenience purposes only
|
||||
if (ph.keys) { // keyword argument
|
||||
arg = argv[cursor]
|
||||
for (k = 0; k < ph.keys.length; k++) {
|
||||
if (arg == undefined) {
|
||||
throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k-1]))
|
||||
}
|
||||
arg = arg[ph.keys[k]]
|
||||
}
|
||||
}
|
||||
else if (ph.param_no) { // positional argument (explicit)
|
||||
arg = argv[ph.param_no]
|
||||
}
|
||||
else { // positional argument (implicit)
|
||||
arg = argv[cursor++]
|
||||
}
|
||||
|
||||
if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {
|
||||
arg = arg()
|
||||
}
|
||||
|
||||
if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) {
|
||||
throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg))
|
||||
}
|
||||
|
||||
if (re.number.test(ph.type)) {
|
||||
is_positive = arg >= 0
|
||||
}
|
||||
|
||||
switch (ph.type) {
|
||||
case 'b':
|
||||
arg = parseInt(arg, 10).toString(2)
|
||||
break
|
||||
case 'c':
|
||||
arg = String.fromCharCode(parseInt(arg, 10))
|
||||
break
|
||||
case 'd':
|
||||
case 'i':
|
||||
arg = parseInt(arg, 10)
|
||||
break
|
||||
case 'j':
|
||||
arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0)
|
||||
break
|
||||
case 'e':
|
||||
arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential()
|
||||
break
|
||||
case 'f':
|
||||
arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg)
|
||||
break
|
||||
case 'g':
|
||||
arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg)
|
||||
break
|
||||
case 'o':
|
||||
arg = (parseInt(arg, 10) >>> 0).toString(8)
|
||||
break
|
||||
case 's':
|
||||
arg = String(arg)
|
||||
arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
|
||||
break
|
||||
case 't':
|
||||
arg = String(!!arg)
|
||||
arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
|
||||
break
|
||||
case 'T':
|
||||
arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase()
|
||||
arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
|
||||
break
|
||||
case 'u':
|
||||
arg = parseInt(arg, 10) >>> 0
|
||||
break
|
||||
case 'v':
|
||||
arg = arg.valueOf()
|
||||
arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
|
||||
break
|
||||
case 'x':
|
||||
arg = (parseInt(arg, 10) >>> 0).toString(16)
|
||||
break
|
||||
case 'X':
|
||||
arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase()
|
||||
break
|
||||
}
|
||||
if (re.json.test(ph.type)) {
|
||||
output += arg
|
||||
}
|
||||
else {
|
||||
if (re.number.test(ph.type) && (!is_positive || ph.sign)) {
|
||||
sign = is_positive ? '+' : '-'
|
||||
arg = arg.toString().replace(re.sign, '')
|
||||
}
|
||||
else {
|
||||
sign = ''
|
||||
}
|
||||
pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' '
|
||||
pad_length = ph.width - (sign + arg).length
|
||||
pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : ''
|
||||
output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
var sprintf_cache = Object.create(null)
|
||||
|
||||
function sprintf_parse(fmt) {
|
||||
if (sprintf_cache[fmt]) {
|
||||
return sprintf_cache[fmt]
|
||||
}
|
||||
|
||||
var _fmt = fmt, match, parse_tree = [], arg_names = 0
|
||||
while (_fmt) {
|
||||
if ((match = re.text.exec(_fmt)) !== null) {
|
||||
parse_tree.push(match[0])
|
||||
}
|
||||
else if ((match = re.modulo.exec(_fmt)) !== null) {
|
||||
parse_tree.push('%')
|
||||
}
|
||||
else if ((match = re.placeholder.exec(_fmt)) !== null) {
|
||||
if (match[2]) {
|
||||
arg_names |= 1
|
||||
var field_list = [], replacement_field = match[2], field_match = []
|
||||
if ((field_match = re.key.exec(replacement_field)) !== null) {
|
||||
field_list.push(field_match[1])
|
||||
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
|
||||
if ((field_match = re.key_access.exec(replacement_field)) !== null) {
|
||||
field_list.push(field_match[1])
|
||||
}
|
||||
else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
|
||||
field_list.push(field_match[1])
|
||||
}
|
||||
else {
|
||||
throw new SyntaxError('[sprintf] failed to parse named argument key')
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new SyntaxError('[sprintf] failed to parse named argument key')
|
||||
}
|
||||
match[2] = field_list
|
||||
}
|
||||
else {
|
||||
arg_names |= 2
|
||||
}
|
||||
if (arg_names === 3) {
|
||||
throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported')
|
||||
}
|
||||
|
||||
parse_tree.push(
|
||||
{
|
||||
placeholder: match[0],
|
||||
param_no: match[1],
|
||||
keys: match[2],
|
||||
sign: match[3],
|
||||
pad_char: match[4],
|
||||
align: match[5],
|
||||
width: match[6],
|
||||
precision: match[7],
|
||||
type: match[8]
|
||||
}
|
||||
)
|
||||
}
|
||||
else {
|
||||
throw new SyntaxError('[sprintf] unexpected placeholder')
|
||||
}
|
||||
_fmt = _fmt.substring(match[0].length)
|
||||
}
|
||||
return sprintf_cache[fmt] = parse_tree
|
||||
}
|
||||
|
||||
/**
|
||||
* export to either browser or node.js
|
||||
*/
|
||||
/* eslint-disable quote-props */
|
||||
if (typeof exports !== 'undefined') {
|
||||
exports['sprintf'] = sprintf
|
||||
exports['vsprintf'] = vsprintf
|
||||
}
|
||||
if (typeof window !== 'undefined') {
|
||||
window['sprintf'] = sprintf
|
||||
window['vsprintf'] = vsprintf
|
||||
|
||||
if (typeof define === 'function' && define['amd']) {
|
||||
define(function() {
|
||||
return {
|
||||
'sprintf': sprintf,
|
||||
'vsprintf': vsprintf
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
/* eslint-enable quote-props */
|
||||
}(); // eslint-disable-line
|
||||
87
BACK_BACK/node_modules/ip-address/package.json
generated
vendored
Executable file
87
BACK_BACK/node_modules/ip-address/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,87 @@
|
|||
{
|
||||
"name": "ip-address",
|
||||
"description": "A library for parsing IPv4 and IPv6 IP addresses in node and the browser.",
|
||||
"keywords": [
|
||||
"ipv6",
|
||||
"ipv4",
|
||||
"browser",
|
||||
"validation"
|
||||
],
|
||||
"version": "9.0.5",
|
||||
"author": "Beau Gunderson <beau@beaugunderson.com> (https://beaugunderson.com/)",
|
||||
"license": "MIT",
|
||||
"main": "dist/ip-address.js",
|
||||
"types": "dist/ip-address.d.ts",
|
||||
"scripts": {
|
||||
"docs": "documentation build --github --output docs --format html ./ip-address.js",
|
||||
"build": "rm -rf dist; mkdir dist; tsc",
|
||||
"prepack": "npm run build",
|
||||
"release": "release-it",
|
||||
"test-ci": "nyc mocha",
|
||||
"test": "mocha",
|
||||
"watch": "mocha --watch"
|
||||
},
|
||||
"nyc": {
|
||||
"extension": [
|
||||
".ts"
|
||||
],
|
||||
"exclude": [
|
||||
"**/*.d.ts",
|
||||
".eslintrc.js",
|
||||
"coverage/",
|
||||
"dist/",
|
||||
"test/",
|
||||
"tmp/"
|
||||
],
|
||||
"reporter": [
|
||||
"html",
|
||||
"lcov",
|
||||
"text"
|
||||
],
|
||||
"all": true
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"dist"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/beaugunderson/ip-address.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"jsbn": "1.1.0",
|
||||
"sprintf-js": "^1.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.2.18",
|
||||
"@types/jsbn": "^1.2.31",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@types/sprintf-js": "^1.1.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
||||
"@typescript-eslint/parser": "^6.7.2",
|
||||
"browserify": "^17.0.0",
|
||||
"chai": "^4.3.4",
|
||||
"codecov": "^3.8.2",
|
||||
"documentation": "^14.0.2",
|
||||
"eslint": "^8.50.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-filenames": "^1.3.2",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"eslint-plugin-react": "^7.24.0",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
|
||||
"mocha": "^10.2.0",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier": "^3.0.3",
|
||||
"release-it": "^16.2.0",
|
||||
"source-map-support": "^0.5.19",
|
||||
"ts-node": "^10.0.0",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
13
BACK_BACK/node_modules/ip-address/src/address-error.ts
generated
vendored
Executable file
13
BACK_BACK/node_modules/ip-address/src/address-error.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
export class AddressError extends Error {
|
||||
parseMessage?: string;
|
||||
|
||||
constructor(message: string, parseMessage?: string) {
|
||||
super(message);
|
||||
|
||||
this.name = 'AddressError';
|
||||
|
||||
if (parseMessage !== null) {
|
||||
this.parseMessage = parseMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
BACK_BACK/node_modules/ip-address/src/common.ts
generated
vendored
Executable file
32
BACK_BACK/node_modules/ip-address/src/common.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
import { Address4 } from './ipv4';
|
||||
import { Address6 } from './ipv6';
|
||||
|
||||
export interface ReverseFormOptions {
|
||||
omitSuffix?: boolean;
|
||||
}
|
||||
|
||||
export function isInSubnet(this: Address4 | Address6, address: Address4 | Address6) {
|
||||
if (this.subnetMask < address.subnetMask) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.mask(address.subnetMask) === address.mask()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isCorrect(defaultBits: number) {
|
||||
return function (this: Address4 | Address6) {
|
||||
if (this.addressMinusSuffix !== this.correctForm()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.subnetMask === defaultBits && !this.parsedSubnet) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.parsedSubnet === String(this.subnetMask);
|
||||
};
|
||||
}
|
||||
11
BACK_BACK/node_modules/ip-address/src/ip-address.ts
generated
vendored
Executable file
11
BACK_BACK/node_modules/ip-address/src/ip-address.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
import { Address4 } from './ipv4';
|
||||
import { Address6 } from './ipv6';
|
||||
import { AddressError } from './address-error';
|
||||
|
||||
export { Address4 };
|
||||
export { Address6 };
|
||||
export { AddressError };
|
||||
|
||||
import * as helpers from './v6/helpers';
|
||||
|
||||
export const v6 = { helpers };
|
||||
363
BACK_BACK/node_modules/ip-address/src/ipv4.ts
generated
vendored
Executable file
363
BACK_BACK/node_modules/ip-address/src/ipv4.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,363 @@
|
|||
/* eslint-disable no-param-reassign */
|
||||
|
||||
import * as common from './common';
|
||||
import * as constants from './v4/constants';
|
||||
import { AddressError } from './address-error';
|
||||
import { BigInteger } from 'jsbn';
|
||||
import { sprintf } from 'sprintf-js';
|
||||
|
||||
/**
|
||||
* Represents an IPv4 address
|
||||
* @class Address4
|
||||
* @param {string} address - An IPv4 address string
|
||||
*/
|
||||
export class Address4 {
|
||||
address: string;
|
||||
addressMinusSuffix?: string;
|
||||
groups: number = constants.GROUPS;
|
||||
parsedAddress: string[] = [];
|
||||
parsedSubnet: string = '';
|
||||
subnet: string = '/32';
|
||||
subnetMask: number = 32;
|
||||
v4: boolean = true;
|
||||
|
||||
constructor(address: string) {
|
||||
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 AddressError('Invalid subnet mask.');
|
||||
}
|
||||
|
||||
address = address.replace(constants.RE_SUBNET_STRING, '');
|
||||
}
|
||||
|
||||
this.addressMinusSuffix = address;
|
||||
|
||||
this.parsedAddress = this.parse(address);
|
||||
}
|
||||
|
||||
static isValid(address: string): boolean {
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
new Address4(address);
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Parses a v4 address
|
||||
*/
|
||||
parse(address: string) {
|
||||
const groups = address.split('.');
|
||||
|
||||
if (!address.match(constants.RE_ADDRESS)) {
|
||||
throw new AddressError('Invalid IPv4 address.');
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the correct form of an address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
correctForm(): string {
|
||||
return this.parsedAddress.map((part) => parseInt(part, 10)).join('.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the address is correct, false otherwise
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isCorrect = common.isCorrect(constants.BITS);
|
||||
|
||||
/**
|
||||
* Converts a hex string to an IPv4 address object
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @param {string} hex - a hex string to convert
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromHex(hex: string): Address4 {
|
||||
const padded = hex.replace(/:/g, '').padStart(8, '0');
|
||||
const groups = [];
|
||||
let i;
|
||||
|
||||
for (i = 0; i < 8; i += 2) {
|
||||
const h = padded.slice(i, i + 2);
|
||||
|
||||
groups.push(parseInt(h, 16));
|
||||
}
|
||||
|
||||
return new Address4(groups.join('.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an integer into a IPv4 address object
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @param {integer} integer - a number to convert
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromInteger(integer: number): Address4 {
|
||||
return Address4.fromHex(integer.toString(16));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an address from in-addr.arpa form
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @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 {
|
||||
// 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
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
toHex(): string {
|
||||
return this.parsedAddress.map((part) => sprintf('%02x', parseInt(part, 10))).join(':');
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an IPv4 address object to an array of bytes
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Array}
|
||||
*/
|
||||
toArray(): number[] {
|
||||
return this.parsedAddress.map((part) => parseInt(part, 10));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an IPv4 address object to an IPv6 address group
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
toGroup6(): string {
|
||||
const output = [];
|
||||
let i;
|
||||
|
||||
for (i = 0; i < constants.GROUPS; i += 2) {
|
||||
const hex = sprintf(
|
||||
'%02x%02x',
|
||||
parseInt(this.parsedAddress[i], 10),
|
||||
parseInt(this.parsedAddress[i + 1], 10)
|
||||
);
|
||||
|
||||
output.push(sprintf('%x', parseInt(hex, 16)));
|
||||
}
|
||||
|
||||
return output.join(':');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the address as a BigInteger
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
bigInteger(): BigInteger {
|
||||
return new BigInteger(
|
||||
this.parsedAddress.map((n) => sprintf('%02x', parseInt(n, 10))).join(''),
|
||||
16
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function getting start address.
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
_startAddress(): BigInteger {
|
||||
return new BigInteger(this.mask() + '0'.repeat(constants.BITS - this.subnetMask), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* The first address in the range given by this address' subnet.
|
||||
* Often referred to as the Network Address.
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
*/
|
||||
startAddress(): Address4 {
|
||||
return Address4.fromBigInteger(this._startAddress());
|
||||
}
|
||||
|
||||
/**
|
||||
* The first host address in the range given by this address's subnet ie
|
||||
* the first address after the Network Address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
*/
|
||||
startAddressExclusive(): Address4 {
|
||||
const adjust = new BigInteger('1');
|
||||
return Address4.fromBigInteger(this._startAddress().add(adjust));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function getting end address.
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {BigInteger}
|
||||
*/
|
||||
_endAddress(): BigInteger {
|
||||
return new BigInteger(this.mask() + '1'.repeat(constants.BITS - this.subnetMask), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* The last address in the range given by this address' subnet
|
||||
* Often referred to as the Broadcast
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
*/
|
||||
endAddress(): Address4 {
|
||||
return Address4.fromBigInteger(this._endAddress());
|
||||
}
|
||||
|
||||
/**
|
||||
* The last host address in the range given by this address's subnet ie
|
||||
* the last address prior to the Broadcast Address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {Address4}
|
||||
*/
|
||||
endAddressExclusive(): Address4 {
|
||||
const adjust = new BigInteger('1');
|
||||
return Address4.fromBigInteger(this._endAddress().subtract(adjust));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a BigInteger to a v4 address object
|
||||
* @memberof Address4
|
||||
* @static
|
||||
* @param {BigInteger} bigInteger - a BigInteger to convert
|
||||
* @returns {Address4}
|
||||
*/
|
||||
static fromBigInteger(bigInteger: BigInteger): Address4 {
|
||||
return Address4.fromInteger(parseInt(bigInteger.toString(), 10));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first n bits of the address, defaulting to the
|
||||
* subnet mask
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
mask(mask?: number): string {
|
||||
if (mask === undefined) {
|
||||
mask = this.subnetMask;
|
||||
}
|
||||
|
||||
return this.getBitsBase2(0, mask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bits in the given range as a base-2 string
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {string}
|
||||
*/
|
||||
getBitsBase2(start: number, end: number): string {
|
||||
return this.binaryZeroPad().slice(start, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the reversed ip6.arpa form of the address
|
||||
* @memberof Address4
|
||||
* @param {Object} options
|
||||
* @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
|
||||
* @instance
|
||||
* @returns {String}
|
||||
*/
|
||||
reverseForm(options?: common.ReverseFormOptions): string {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
const reversed = this.correctForm().split('.').reverse().join('.');
|
||||
|
||||
if (options.omitSuffix) {
|
||||
return reversed;
|
||||
}
|
||||
|
||||
return sprintf('%s.in-addr.arpa.', reversed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given address is in the subnet of the current address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isInSubnet = common.isInSubnet;
|
||||
|
||||
/**
|
||||
* Returns true if the given address is a multicast address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMulticast(): boolean {
|
||||
return this.isInSubnet(new Address4('224.0.0.0/4'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a zero-padded base-2 string representation of the address
|
||||
* @memberof Address4
|
||||
* @instance
|
||||
* @returns {string}
|
||||
*/
|
||||
binaryZeroPad(): string {
|
||||
return this.bigInteger().toString(2).padStart(constants.BITS, '0');
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups an IPv4 address for inclusion at the end of an IPv6 address
|
||||
* @returns {String}
|
||||
*/
|
||||
groupForV6(): string {
|
||||
const segments = this.parsedAddress;
|
||||
|
||||
return this.address.replace(
|
||||
constants.RE_ADDRESS,
|
||||
sprintf(
|
||||
'<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',
|
||||
segments.slice(0, 2).join('.'),
|
||||
segments.slice(2, 4).join('.')
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
1214
BACK_BACK/node_modules/ip-address/src/ipv6.ts
generated
vendored
Executable file
1214
BACK_BACK/node_modules/ip-address/src/ipv6.ts
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
6
BACK_BACK/node_modules/ip-address/src/v4/constants.ts
generated
vendored
Executable file
6
BACK_BACK/node_modules/ip-address/src/v4/constants.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
export const BITS = 32;
|
||||
export const GROUPS = 4;
|
||||
|
||||
export const 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;
|
||||
|
||||
export const RE_SUBNET_STRING = /\/\d{1,2}$/;
|
||||
79
BACK_BACK/node_modules/ip-address/src/v6/constants.ts
generated
vendored
Executable file
79
BACK_BACK/node_modules/ip-address/src/v6/constants.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
export const BITS = 128;
|
||||
export const GROUPS = 8;
|
||||
|
||||
/**
|
||||
* Represents IPv6 address scopes
|
||||
* @memberof Address6
|
||||
* @static
|
||||
*/
|
||||
export const SCOPES: { [key: number]: string | undefined } = {
|
||||
0: 'Reserved',
|
||||
1: 'Interface local',
|
||||
2: 'Link local',
|
||||
4: 'Admin local',
|
||||
5: 'Site local',
|
||||
8: 'Organization local',
|
||||
14: 'Global',
|
||||
15: 'Reserved',
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Represents IPv6 address types
|
||||
* @memberof Address6
|
||||
* @static
|
||||
*/
|
||||
export const TYPES: { [key: string]: string | undefined } = {
|
||||
'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',
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* A regular expression that matches bad characters in an IPv6 address
|
||||
* @memberof Address6
|
||||
* @static
|
||||
*/
|
||||
export const RE_BAD_CHARACTERS = /([^0-9a-f:/%])/gi;
|
||||
|
||||
/**
|
||||
* A regular expression that matches an incorrect IPv6 address
|
||||
* @memberof Address6
|
||||
* @static
|
||||
*/
|
||||
export const RE_BAD_ADDRESS = /([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;
|
||||
|
||||
/**
|
||||
* A regular expression that matches an IPv6 subnet
|
||||
* @memberof Address6
|
||||
* @static
|
||||
*/
|
||||
export const RE_SUBNET_STRING = /\/\d{1,3}(?=%|$)/;
|
||||
|
||||
/**
|
||||
* A regular expression that matches an IPv6 zone
|
||||
* @memberof Address6
|
||||
* @static
|
||||
*/
|
||||
export const RE_ZONE_STRING = /%.*$/;
|
||||
|
||||
export const RE_URL = new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/);
|
||||
export const RE_URL_WITH_PORT = new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);
|
||||
60
BACK_BACK/node_modules/ip-address/src/v6/helpers.ts
generated
vendored
Executable file
60
BACK_BACK/node_modules/ip-address/src/v6/helpers.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
import { sprintf } from 'sprintf-js';
|
||||
|
||||
/**
|
||||
* @returns {String} the string with all zeroes contained in a <span>
|
||||
*/
|
||||
export function spanAllZeroes(s: string): string {
|
||||
return s.replace(/(0+)/g, '<span class="zero">$1</span>');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {String} the string with each character contained in a <span>
|
||||
*/
|
||||
export function spanAll(s: string, offset: number = 0): string {
|
||||
const letters = s.split('');
|
||||
|
||||
return letters
|
||||
.map(
|
||||
(n, i) =>
|
||||
sprintf(
|
||||
'<span class="digit value-%s position-%d">%s</span>',
|
||||
n,
|
||||
i + offset,
|
||||
spanAllZeroes(n)
|
||||
) // XXX Use #base-2 .value-0 instead?
|
||||
)
|
||||
.join('');
|
||||
}
|
||||
|
||||
function spanLeadingZeroesSimple(group: string): string {
|
||||
return group.replace(/^(0+)/, '<span class="zero">$1</span>');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {String} the string with leading zeroes contained in a <span>
|
||||
*/
|
||||
export function spanLeadingZeroes(address: string): string {
|
||||
const groups = address.split(':');
|
||||
|
||||
return groups.map((g) => spanLeadingZeroesSimple(g)).join(':');
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups an address
|
||||
* @returns {String} a grouped address
|
||||
*/
|
||||
export function simpleGroup(addressString: string, offset: number = 0): string[] {
|
||||
const groups = addressString.split(':');
|
||||
|
||||
return groups.map((g, i) => {
|
||||
if (/group-v4/.test(g)) {
|
||||
return g;
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'<span class="hover-group group-%d">%s</span>',
|
||||
i + offset,
|
||||
spanLeadingZeroesSimple(g)
|
||||
);
|
||||
});
|
||||
}
|
||||
99
BACK_BACK/node_modules/ip-address/src/v6/regular-expressions.ts
generated
vendored
Executable file
99
BACK_BACK/node_modules/ip-address/src/v6/regular-expressions.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,99 @@
|
|||
import * as v6 from './constants';
|
||||
import { sprintf } from 'sprintf-js';
|
||||
|
||||
export function groupPossibilities(possibilities: string[]): string {
|
||||
return sprintf('(%s)', possibilities.join('|'));
|
||||
}
|
||||
|
||||
export function padGroup(group: string): string {
|
||||
if (group.length < 4) {
|
||||
return sprintf('0{0,%d}%s', 4 - group.length, group);
|
||||
}
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
export const ADDRESS_BOUNDARY = '[^A-Fa-f0-9:]';
|
||||
|
||||
export function simpleRegularExpression(groups: string[]) {
|
||||
const zeroIndexes: number[] = [];
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
export function possibleElisions(
|
||||
elidedGroups: number,
|
||||
moreLeft?: boolean,
|
||||
moreRight?: boolean
|
||||
): string {
|
||||
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(sprintf('%s(:0{1,4}){1,%d}', left, elidedGroups - 1));
|
||||
|
||||
// 5. elision from the right side
|
||||
possibilities.push(sprintf('(0{1,4}:){1,%d}%s', elidedGroups - 1, right));
|
||||
|
||||
// 6. no elision
|
||||
possibilities.push(sprintf('(0{1,4}:){%d}0{1,4}', elidedGroups - 1));
|
||||
|
||||
// 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(
|
||||
sprintf(
|
||||
'(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}',
|
||||
position,
|
||||
elidedGroups - position - groups - 1
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return groupPossibilities(possibilities);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue