mybase 1.1.46 → 1.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ip6addr.d.ts +1 -1
- package/mybase.js +1 -1
- package/package.json +5 -5
- package/ts/funcs/isLANIp.d.ts +1 -1
- package/ts/funcs/isLANIp.js +6 -6
- package/ts/funcs/isLANIp.ts +1 -1
- package/ts/funcs/isLoopbackIP.d.ts +1 -1
- package/ts/funcs/isLoopbackIP.js +3 -3
- package/ts/funcs/isLoopbackIP.ts +1 -1
- package/ts/models/IPAddress.d.ts +1 -1
- package/ts/models/IPAddress.js +11 -11
- package/ts/models/IPAddress.test.ts +1 -1
- package/ts/models/IPAddress.ts +1 -1
- package/ts/models/OTPGenerator.test.ts +1 -1
- package/tsconfig.tsbuildinfo +0 -1
package/ip6addr.d.ts
CHANGED
package/mybase.js
CHANGED
|
@@ -9,7 +9,7 @@ const chalk = require('chalk')
|
|
|
9
9
|
const _validURL = require('@7c/validurl')
|
|
10
10
|
const validator = require('validator')
|
|
11
11
|
const sha512 = require('js-sha512')
|
|
12
|
-
const ip6addr = require('ip6addr')
|
|
12
|
+
const ip6addr = require('@7c/node-ip6addr')
|
|
13
13
|
|
|
14
14
|
const private_network_cidrs = [ip6addr.createCIDR('10.0.0.0/8')
|
|
15
15
|
,ip6addr.createCIDR('172.16.0.0/12')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mybase",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.47",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "mybase.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"@7c/node-ip6addr": "https://github.com/7c/node-ip6addr.git",
|
|
12
13
|
"@7c/validurl": "0.0.3",
|
|
13
14
|
"@types/debug": "^4.1.12",
|
|
14
15
|
"@types/ip6addr": "^0.2.6",
|
|
@@ -21,7 +22,6 @@
|
|
|
21
22
|
"debug": "^4.3.4",
|
|
22
23
|
"ip-range-check": "^0.2.0",
|
|
23
24
|
"ip6": "=0.2.7",
|
|
24
|
-
"ip6addr": "github:7c/node-ip6addr#db6d558af1f314bcb0a733fd61611fa85e1a3eff",
|
|
25
25
|
"js-sha512": "^0.8.0",
|
|
26
26
|
"knex": "^3.1.0",
|
|
27
27
|
"mysql": "^2.18.1",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jest/globals": "^29.7.0",
|
|
36
|
-
"@types/jest": "^29.5.
|
|
36
|
+
"@types/jest": "^29.5.14",
|
|
37
37
|
"chai": "^4.2.0",
|
|
38
38
|
"jest": "^29.7.0",
|
|
39
|
-
"mocha": "^
|
|
39
|
+
"mocha": "^11.1.0",
|
|
40
40
|
"should": "^13.2.3",
|
|
41
|
-
"ts-jest": "^29.
|
|
41
|
+
"ts-jest": "^29.2.5"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/ts/funcs/isLANIp.d.ts
CHANGED
package/ts/funcs/isLANIp.js
CHANGED
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.private_network_cidrs = void 0;
|
|
7
7
|
exports.isLANIp = isLANIp;
|
|
8
|
-
const
|
|
8
|
+
const node_ip6addr_1 = __importDefault(require("@7c/node-ip6addr"));
|
|
9
9
|
const net_1 = __importDefault(require("net"));
|
|
10
10
|
exports.private_network_cidrs = [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
node_ip6addr_1.default.createCIDR('10.0.0.0/8'),
|
|
12
|
+
node_ip6addr_1.default.createCIDR('172.16.0.0/12'),
|
|
13
|
+
node_ip6addr_1.default.createCIDR('192.168.0.0/16'),
|
|
14
|
+
node_ip6addr_1.default.createCIDR('fd00::/8'), // Reserved by IETF for future use, but not currently in active use.
|
|
15
|
+
node_ip6addr_1.default.createCIDR('fc00::/8'), // The range currently in use for local communications within a site or organization.
|
|
16
16
|
];
|
|
17
17
|
function isLANIp(ip) {
|
|
18
18
|
ip = normalizeIp(ip);
|
package/ts/funcs/isLANIp.ts
CHANGED
package/ts/funcs/isLoopbackIP.js
CHANGED
|
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.local_network_cidrs = void 0;
|
|
7
7
|
exports.isLoopbackIP = isLoopbackIP;
|
|
8
|
-
const
|
|
8
|
+
const node_ip6addr_1 = __importDefault(require("@7c/node-ip6addr"));
|
|
9
9
|
const net_1 = __importDefault(require("net"));
|
|
10
10
|
exports.local_network_cidrs = [
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
node_ip6addr_1.default.createCIDR('127.0.0.0/8'),
|
|
12
|
+
node_ip6addr_1.default.createCIDR('::1/128')
|
|
13
13
|
];
|
|
14
14
|
function isLoopbackIP(ip) {
|
|
15
15
|
ip = normalizeIp(ip);
|
package/ts/funcs/isLoopbackIP.ts
CHANGED
package/ts/models/IPAddress.d.ts
CHANGED
package/ts/models/IPAddress.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.IPAddress = void 0;
|
|
|
7
7
|
/// <reference path="./../../ip6addr.d.ts" />
|
|
8
8
|
const debug_1 = __importDefault(require("debug"));
|
|
9
9
|
const __1 = require("./../");
|
|
10
|
-
const
|
|
10
|
+
const node_ip6addr_1 = __importDefault(require("@7c/node-ip6addr"));
|
|
11
11
|
const net_1 = __importDefault(require("net"));
|
|
12
12
|
const ip6 = require('ip6'); // "url": "https://github.com/elgs/ip6"
|
|
13
13
|
const dbg = (0, debug_1.default)('_IPAddress');
|
|
@@ -18,10 +18,10 @@ class IPAddress {
|
|
|
18
18
|
if (ip === '-')
|
|
19
19
|
ip = '0.0.0.0'; // is this really required?
|
|
20
20
|
try {
|
|
21
|
-
this._ip =
|
|
21
|
+
this._ip = node_ip6addr_1.default.parse(ip);
|
|
22
22
|
if (this._ip._attrs.ipv4Mapped) {
|
|
23
23
|
// we wany to convert it to ipv4
|
|
24
|
-
this._ip =
|
|
24
|
+
this._ip = node_ip6addr_1.default.parse(this._ip.toString({ format: 'v4' }));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
catch (err) {
|
|
@@ -157,7 +157,7 @@ class IPAddress {
|
|
|
157
157
|
const randomBigInt = BigInt(Math.floor(Math.random() * (Number(range) + 1))) + start;
|
|
158
158
|
// dbg('randomBigInt', randomBigInt)
|
|
159
159
|
// Convert the BigInt back to an IP address
|
|
160
|
-
const randomIp =
|
|
160
|
+
const randomIp = node_ip6addr_1.default.parse(randomBigInt);
|
|
161
161
|
// dbg('randomCIDRIp', randomIp.toString())
|
|
162
162
|
return new IPAddress(randomIp.toString());
|
|
163
163
|
}
|
|
@@ -233,20 +233,20 @@ class IPAddress {
|
|
|
233
233
|
}
|
|
234
234
|
exports.IPAddress = IPAddress;
|
|
235
235
|
IPAddress.loopback_cidrs4 = [
|
|
236
|
-
|
|
236
|
+
node_ip6addr_1.default.createCIDR('127.0.0.0/8'),
|
|
237
237
|
];
|
|
238
238
|
IPAddress.loopback_cidrs6 = [
|
|
239
|
-
|
|
239
|
+
node_ip6addr_1.default.createCIDR('::1/128') // yes ipv6 has single address
|
|
240
240
|
];
|
|
241
241
|
IPAddress.loopback_cidrs = IPAddress.loopback_cidrs4.concat(IPAddress.loopback_cidrs6);
|
|
242
242
|
IPAddress.lan_cidrs4 = [
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
node_ip6addr_1.default.createCIDR('10.0.0.0/8'),
|
|
244
|
+
node_ip6addr_1.default.createCIDR('172.16.0.0/12'),
|
|
245
|
+
node_ip6addr_1.default.createCIDR('192.168.0.0/16'),
|
|
246
246
|
];
|
|
247
247
|
IPAddress.lan_cidrs6 = [
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
node_ip6addr_1.default.createCIDR('fd00::/8'), // Reserved by IETF for future use, but not currently in active use.
|
|
249
|
+
node_ip6addr_1.default.createCIDR('fc00::/8'), // The range currently in use for local communications within a site or organization.
|
|
250
250
|
];
|
|
251
251
|
IPAddress.lan_cidrs = IPAddress.lan_cidrs4.concat(IPAddress.lan_cidrs6);
|
|
252
252
|
IPAddress.local_cidrs = IPAddress.loopback_cidrs.concat(IPAddress.lan_cidrs);
|
package/ts/models/IPAddress.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference path="./../../ip6addr.d.ts" />
|
|
2
2
|
import debug from 'debug'
|
|
3
3
|
import { randomIP, randomIP6, } from "./../"
|
|
4
|
-
import ip6addr, { Addr, ToStringOpts } from 'ip6addr'
|
|
4
|
+
import ip6addr, { Addr, ToStringOpts } from '@7c/node-ip6addr'
|
|
5
5
|
import net from 'net'
|
|
6
6
|
const ip6 = require('ip6') // "url": "https://github.com/elgs/ip6"
|
|
7
7
|
const dbg = debug('_IPAddress')
|
package/tsconfig.tsbuildinfo
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["./ip6addr.d.ts","./ts/global.ts","./ts/index.ts","./ts/types.ts","./ts/funcs/geoip2paths.ts","./ts/funcs/maxruntimehours.ts","./ts/funcs/asjson.ts","./ts/funcs/ensurefolder.ts","./ts/funcs/filecacheisvalid.ts","./ts/funcs/getmysql1.ts","./ts/funcs/getmysql2.ts","./ts/funcs/getweeknumber.ts","./ts/funcs/hash_sha512.ts","./ts/funcs/initmysql2pool.ts","./ts/funcs/int2ip.ts","./ts/funcs/ip2int.ts","./ts/funcs/islanip.ts","./ts/funcs/islocal.ts","./ts/funcs/isloopbackip.ts","./ts/funcs/knexconnection.ts","./ts/funcs/promisetimeout.ts","./ts/funcs/randomip.ts","./ts/funcs/randomip6.ts","./ts/funcs/randomstring.ts","./ts/funcs/randomtcpport.ts","./ts/funcs/randomutfstring.ts","./ts/funcs/utcnow.ts","./ts/funcs/validemail.ts","./ts/funcs/validip.ts","./ts/funcs/vaultfill.ts","./ts/funcs/vaultread.ts","./ts/funcs/wait.ts","./ts/models/ipaddress.ts","./ts/models/interfaces.ts","./ts/models/otpgenerator.ts","./ts/models/timespan.ts","./ts/models/unixtime.ts"],"version":"5.7.2"}
|