@libp2p/utils 5.2.2 → 5.2.3-c9ed1c7d6

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.
@@ -1,11 +1,11 @@
1
- import isIpPrivate from 'private-ip';
1
+ import { isPrivateIp } from '../private-ip.js';
2
2
  /**
3
3
  * Check if a given multiaddr has a private address.
4
4
  */
5
5
  export function isPrivate(ma) {
6
6
  try {
7
7
  const { address } = ma.nodeAddress();
8
- return Boolean(isIpPrivate(address));
8
+ return Boolean(isPrivateIp(address));
9
9
  }
10
10
  catch {
11
11
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"is-private.js","sourceRoot":"","sources":["../../../src/multiaddr/is-private.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,YAAY,CAAA;AAGpC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAE,EAAa;IACtC,IAAI,CAAC;QACH,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,CAAA;QAEpC,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"is-private.js","sourceRoot":"","sources":["../../../src/multiaddr/is-private.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C;;GAEG;AACH,MAAM,UAAU,SAAS,CAAE,EAAa;IACtC,IAAI,CAAC;QACH,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,CAAA;QAEpC,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
@@ -1,14 +1,14 @@
1
1
  import { Queue, type QueueAddOptions } from './queue/index.js';
2
2
  import type { Job } from './queue/job.js';
3
3
  import type { PeerId } from '@libp2p/interface';
4
- export interface PeerQueueOptions extends QueueAddOptions {
4
+ export interface PeerQueueJobOptions extends QueueAddOptions {
5
5
  peerId: PeerId;
6
6
  }
7
7
  /**
8
8
  * Extends Queue to add support for querying queued jobs by peer id
9
9
  */
10
- export declare class PeerQueue<JobReturnType = void> extends Queue<JobReturnType, PeerQueueOptions> {
10
+ export declare class PeerQueue<JobReturnType = void, JobOptions extends PeerQueueJobOptions = PeerQueueJobOptions> extends Queue<JobReturnType, JobOptions> {
11
11
  has(peerId: PeerId): boolean;
12
- find(peerId: PeerId): Job<PeerQueueOptions, JobReturnType> | undefined;
12
+ find(peerId: PeerId): Job<JobOptions, JobReturnType> | undefined;
13
13
  }
14
14
  //# sourceMappingURL=peer-queue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"peer-queue.d.ts","sourceRoot":"","sources":["../../src/peer-queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,qBAAa,SAAS,CAAC,aAAa,GAAG,IAAI,CAAE,SAAQ,KAAK,CAAC,aAAa,EAAE,gBAAgB,CAAC;IACzF,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAI7B,IAAI,CAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,gBAAgB,EAAE,aAAa,CAAC,GAAG,SAAS;CAKxE"}
1
+ {"version":3,"file":"peer-queue.d.ts","sourceRoot":"","sources":["../../src/peer-queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,qBAAa,SAAS,CAAC,aAAa,GAAG,IAAI,EAAE,UAAU,SAAS,mBAAmB,GAAG,mBAAmB,CAAE,SAAQ,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC;IACjJ,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAI7B,IAAI,CAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,SAAS;CAKlE"}
@@ -1 +1 @@
1
- {"version":3,"file":"peer-queue.js","sourceRoot":"","sources":["../../src/peer-queue.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,KAAK,EAAwB,MAAM,kBAAkB,CAAA;AAQ9D;;GAEG;AACH,MAAM,OAAO,SAAgC,SAAQ,KAAsC;IACzF,GAAG,CAAE,MAAc;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;IAClC,CAAC;IAED,IAAI,CAAE,MAAc;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC3B,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC1C,CAAC,CAAC,CAAA;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"peer-queue.js","sourceRoot":"","sources":["../../src/peer-queue.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,KAAK,EAAwB,MAAM,kBAAkB,CAAA;AAQ9D;;GAEG;AACH,MAAM,OAAO,SAA8F,SAAQ,KAAgC;IACjJ,GAAG,CAAE,MAAc;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;IAClC,CAAC;IAED,IAAI,CAAE,MAAc;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC3B,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC1C,CAAC,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export declare function isPrivateIp(ip: string): boolean | undefined;
2
+ //# sourceMappingURL=private-ip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-ip.d.ts","sourceRoot":"","sources":["../../src/private-ip.ts"],"names":[],"mappings":"AAwDA,wBAAgB,WAAW,CAAE,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAI5D"}
@@ -0,0 +1,60 @@
1
+ import { isIPv4, isIPv6 } from '@chainsafe/is-ip';
2
+ import { Netmask } from 'netmask';
3
+ const PRIVATE_IP_RANGES = [
4
+ '0.0.0.0/8',
5
+ '10.0.0.0/8',
6
+ '100.64.0.0/10',
7
+ '127.0.0.0/8',
8
+ '169.254.0.0/16',
9
+ '172.16.0.0/12',
10
+ '192.0.0.0/24',
11
+ '192.0.0.0/29',
12
+ '192.0.0.8/32',
13
+ '192.0.0.9/32',
14
+ '192.0.0.10/32',
15
+ '192.0.0.170/32',
16
+ '192.0.0.171/32',
17
+ '192.0.2.0/24',
18
+ '192.31.196.0/24',
19
+ '192.52.193.0/24',
20
+ '192.88.99.0/24',
21
+ '192.168.0.0/16',
22
+ '192.175.48.0/24',
23
+ '198.18.0.0/15',
24
+ '198.51.100.0/24',
25
+ '203.0.113.0/24',
26
+ '240.0.0.0/4',
27
+ '255.255.255.255/32'
28
+ ];
29
+ const NETMASK_RANGES = PRIVATE_IP_RANGES.map(ipRange => new Netmask(ipRange));
30
+ function ipv4Check(ipAddr) {
31
+ for (const r of NETMASK_RANGES) {
32
+ if (r.contains(ipAddr))
33
+ return true;
34
+ }
35
+ return false;
36
+ }
37
+ function ipv6Check(ipAddr) {
38
+ return /^::$/.test(ipAddr) ||
39
+ /^::1$/.test(ipAddr) ||
40
+ /^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(ipAddr) ||
41
+ /^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(ipAddr) ||
42
+ /^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(ipAddr) ||
43
+ /^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||
44
+ /^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||
45
+ /^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||
46
+ /^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||
47
+ /^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||
48
+ /^f[c-d]([0-9a-fA-F]{2,2}):/i.test(ipAddr) ||
49
+ /^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(ipAddr) ||
50
+ /^ff([0-9a-fA-F]{2,2}):/i.test(ipAddr);
51
+ }
52
+ export function isPrivateIp(ip) {
53
+ if (isIPv4(ip))
54
+ return ipv4Check(ip);
55
+ else if (isIPv6(ip))
56
+ return ipv6Check(ip);
57
+ else
58
+ return undefined;
59
+ }
60
+ //# sourceMappingURL=private-ip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-ip.js","sourceRoot":"","sources":["../../src/private-ip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,iBAAiB,GAAG;IACxB,WAAW;IACX,YAAY;IACZ,eAAe;IACf,aAAa;IACb,gBAAgB;IAChB,eAAe;IACf,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,oBAAoB;CACrB,CAAA;AAED,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;AAE7E,SAAS,SAAS,CAAE,MAAc;IAChC,KAAK,MAAM,CAAC,IAAI,cAAc,EAAE,CAAC;QAC/B,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAA;IACrC,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,SAAS,CAAE,MAAc;IAChC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;QACpB,iEAAiE,CAAC,IAAI,CAAC,MAAM,CAAC;QAC9E,mEAAmE,CAAC,IAAI,CAAC,MAAM,CAAC;QAChF,mEAAmE,CAAC,IAAI,CAAC,MAAM,CAAC;QAChF,uFAAuF,CAAC,IAAI,CAAC,MAAM,CAAC;QACpG,gIAAgI,CAAC,IAAI,CAAC,MAAM,CAAC;QAC7I,4IAA4I,CAAC,IAAI,CAAC,MAAM,CAAC;QACzJ,mIAAmI,CAAC,IAAI,CAAC,MAAM,CAAC;QAChJ,mJAAmJ,CAAC,IAAI,CAAC,MAAM,CAAC;QAChK,6BAA6B,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1C,6BAA6B,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1C,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAC1C,CAAC;AAED,MAAM,UAAU,WAAW,CAAE,EAAU;IACrC,IAAI,MAAM,CAAC,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC,EAAE,CAAC,CAAA;SAC/B,IAAI,MAAM,CAAC,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC,EAAE,CAAC,CAAA;;QACpC,OAAO,SAAS,CAAA;AACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/utils",
3
- "version": "5.2.2",
3
+ "version": "5.2.3-c9ed1c7d6",
4
4
  "description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/utils#readme",
@@ -80,6 +80,10 @@
80
80
  "types": "./dist/src/peer-queue.d.ts",
81
81
  "import": "./dist/src/peer-queue.js"
82
82
  },
83
+ "./private-ip": {
84
+ "types": "./dist/src/private-ip.d.ts",
85
+ "import": "./dist/src/private-ip.js"
86
+ },
83
87
  "./queue": {
84
88
  "types": "./dist/src/queue/index.d.ts",
85
89
  "import": "./dist/src/queue/index.js"
@@ -123,8 +127,8 @@
123
127
  },
124
128
  "dependencies": {
125
129
  "@chainsafe/is-ip": "^2.0.2",
126
- "@libp2p/interface": "^1.1.2",
127
- "@libp2p/logger": "^4.0.5",
130
+ "@libp2p/interface": "1.1.2-c9ed1c7d6",
131
+ "@libp2p/logger": "4.0.5-c9ed1c7d6",
128
132
  "@multiformats/multiaddr": "^12.1.10",
129
133
  "@multiformats/multiaddr-matcher": "^1.1.0",
130
134
  "delay": "^6.0.0",
@@ -132,14 +136,15 @@
132
136
  "is-loopback-addr": "^2.0.1",
133
137
  "it-pushable": "^3.2.3",
134
138
  "it-stream-types": "^2.0.1",
139
+ "netmask": "^2.0.2",
135
140
  "p-defer": "^4.0.0",
136
- "private-ip": "^3.0.1",
137
141
  "race-event": "^1.1.0",
138
142
  "race-signal": "^1.0.2",
139
143
  "uint8arraylist": "^2.4.7"
140
144
  },
141
145
  "devDependencies": {
142
- "@libp2p/peer-id-factory": "^4.0.5",
146
+ "@libp2p/peer-id-factory": "4.0.5-c9ed1c7d6",
147
+ "@types/netmask": "^2.0.5",
143
148
  "aegir": "^42.0.0",
144
149
  "delay": "^6.0.0",
145
150
  "it-all": "^3.0.3",
@@ -1,4 +1,4 @@
1
- import isIpPrivate from 'private-ip'
1
+ import { isPrivateIp } from '../private-ip.js'
2
2
  import type { Multiaddr } from '@multiformats/multiaddr'
3
3
 
4
4
  /**
@@ -8,7 +8,7 @@ export function isPrivate (ma: Multiaddr): boolean {
8
8
  try {
9
9
  const { address } = ma.nodeAddress()
10
10
 
11
- return Boolean(isIpPrivate(address))
11
+ return Boolean(isPrivateIp(address))
12
12
  } catch {
13
13
  return true
14
14
  }
package/src/peer-queue.ts CHANGED
@@ -4,19 +4,19 @@ import { Queue, type QueueAddOptions } from './queue/index.js'
4
4
  import type { Job } from './queue/job.js'
5
5
  import type { PeerId } from '@libp2p/interface'
6
6
 
7
- export interface PeerQueueOptions extends QueueAddOptions {
7
+ export interface PeerQueueJobOptions extends QueueAddOptions {
8
8
  peerId: PeerId
9
9
  }
10
10
 
11
11
  /**
12
12
  * Extends Queue to add support for querying queued jobs by peer id
13
13
  */
14
- export class PeerQueue<JobReturnType = void> extends Queue<JobReturnType, PeerQueueOptions> {
14
+ export class PeerQueue<JobReturnType = void, JobOptions extends PeerQueueJobOptions = PeerQueueJobOptions> extends Queue<JobReturnType, JobOptions> {
15
15
  has (peerId: PeerId): boolean {
16
16
  return this.find(peerId) != null
17
17
  }
18
18
 
19
- find (peerId: PeerId): Job<PeerQueueOptions, JobReturnType> | undefined {
19
+ find (peerId: PeerId): Job<JobOptions, JobReturnType> | undefined {
20
20
  return this.queue.find(job => {
21
21
  return peerId.equals(job.options.peerId)
22
22
  })
@@ -0,0 +1,61 @@
1
+ import { isIPv4, isIPv6 } from '@chainsafe/is-ip'
2
+ import { Netmask } from 'netmask'
3
+
4
+ const PRIVATE_IP_RANGES = [
5
+ '0.0.0.0/8',
6
+ '10.0.0.0/8',
7
+ '100.64.0.0/10',
8
+ '127.0.0.0/8',
9
+ '169.254.0.0/16',
10
+ '172.16.0.0/12',
11
+ '192.0.0.0/24',
12
+ '192.0.0.0/29',
13
+ '192.0.0.8/32',
14
+ '192.0.0.9/32',
15
+ '192.0.0.10/32',
16
+ '192.0.0.170/32',
17
+ '192.0.0.171/32',
18
+ '192.0.2.0/24',
19
+ '192.31.196.0/24',
20
+ '192.52.193.0/24',
21
+ '192.88.99.0/24',
22
+ '192.168.0.0/16',
23
+ '192.175.48.0/24',
24
+ '198.18.0.0/15',
25
+ '198.51.100.0/24',
26
+ '203.0.113.0/24',
27
+ '240.0.0.0/4',
28
+ '255.255.255.255/32'
29
+ ]
30
+
31
+ const NETMASK_RANGES = PRIVATE_IP_RANGES.map(ipRange => new Netmask(ipRange))
32
+
33
+ function ipv4Check (ipAddr: string): boolean {
34
+ for (const r of NETMASK_RANGES) {
35
+ if (r.contains(ipAddr)) return true
36
+ }
37
+
38
+ return false
39
+ }
40
+
41
+ function ipv6Check (ipAddr: string): boolean {
42
+ return /^::$/.test(ipAddr) ||
43
+ /^::1$/.test(ipAddr) ||
44
+ /^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(ipAddr) ||
45
+ /^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(ipAddr) ||
46
+ /^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(ipAddr) ||
47
+ /^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||
48
+ /^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||
49
+ /^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||
50
+ /^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||
51
+ /^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||
52
+ /^f[c-d]([0-9a-fA-F]{2,2}):/i.test(ipAddr) ||
53
+ /^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(ipAddr) ||
54
+ /^ff([0-9a-fA-F]{2,2}):/i.test(ipAddr)
55
+ }
56
+
57
+ export function isPrivateIp (ip: string): boolean | undefined {
58
+ if (isIPv4(ip)) return ipv4Check(ip)
59
+ else if (isIPv6(ip)) return ipv6Check(ip)
60
+ else return undefined
61
+ }
@@ -1,70 +0,0 @@
1
- {
2
- "AbstractStream": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.abstract_stream.AbstractStream.html",
3
- "./abstract-stream:AbstractStream": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.abstract_stream.AbstractStream.html",
4
- "AbstractStreamInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.abstract_stream.AbstractStreamInit.html",
5
- "./abstract-stream:AbstractStreamInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.abstract_stream.AbstractStreamInit.html",
6
- "certifiedAddressesFirst": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.certifiedAddressesFirst.html",
7
- "./address-sort:certifiedAddressesFirst": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.certifiedAddressesFirst.html",
8
- "circuitRelayAddressesLast": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.circuitRelayAddressesLast.html",
9
- "./address-sort:circuitRelayAddressesLast": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.circuitRelayAddressesLast.html",
10
- "defaultAddressSort": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.defaultAddressSort.html",
11
- "./address-sort:defaultAddressSort": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.defaultAddressSort.html",
12
- "publicAddressesFirst": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.publicAddressesFirst.html",
13
- "./address-sort:publicAddressesFirst": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.publicAddressesFirst.html",
14
- "arrayEquals": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.array_equals.arrayEquals.html",
15
- "./array-equals:arrayEquals": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.array_equals.arrayEquals.html",
16
- "closeSource": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close_source.closeSource.html",
17
- "./close-source:closeSource": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close_source.closeSource.html",
18
- "Errors": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.ip_port_to_multiaddr.Errors.html",
19
- "./ip-port-to-multiaddr:Errors": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.ip_port_to_multiaddr.Errors.html",
20
- "ipPortToMultiaddr": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.ip_port_to_multiaddr.ipPortToMultiaddr.html",
21
- "./ip-port-to-multiaddr:ipPortToMultiaddr": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.ip_port_to_multiaddr.ipPortToMultiaddr.html",
22
- "isPromise": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is_promise.isPromise.html",
23
- "./is-promise:isPromise": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is_promise.isPromise.html",
24
- "isLoopback": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_loopback.isLoopback.html",
25
- "./multiaddr/is-loopback:isLoopback": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_loopback.isLoopback.html",
26
- "isPrivate": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_private.isPrivate.html",
27
- "./multiaddr/is-private:isPrivate": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_private.isPrivate.html",
28
- "PeerQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.peer_queue.PeerQueue.html",
29
- "./peer-queue:PeerQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.peer_queue.PeerQueue.html",
30
- "PeerQueueOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.peer_queue.PeerQueueOptions.html",
31
- "./peer-queue:PeerQueueOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.peer_queue.PeerQueueOptions.html",
32
- "Queue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.queue.Queue.html",
33
- "./queue:Queue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.queue.Queue.html",
34
- "JobMatcher": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.JobMatcher.html",
35
- "./queue:JobMatcher": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.JobMatcher.html",
36
- "QueueAddOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueAddOptions.html",
37
- "./queue:QueueAddOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueAddOptions.html",
38
- "QueueEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueEvents.html",
39
- "./queue:QueueEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueEvents.html",
40
- "QueueInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueInit.html",
41
- "./queue:QueueInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueInit.html",
42
- "RunFunction": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.RunFunction.html",
43
- "./queue:RunFunction": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.RunFunction.html",
44
- "JobStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_utils.queue.JobStatus.html",
45
- "./queue:JobStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_utils.queue.JobStatus.html",
46
- "RateLimiter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.rate_limiter.RateLimiter.html",
47
- "./rate-limiter:RateLimiter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.rate_limiter.RateLimiter.html",
48
- "GetKeySecDurationOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.GetKeySecDurationOptions.html",
49
- "./rate-limiter:GetKeySecDurationOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.GetKeySecDurationOptions.html",
50
- "RateLimiterInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateLimiterInit.html",
51
- "./rate-limiter:RateLimiterInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateLimiterInit.html",
52
- "RateLimiterResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateLimiterResult.html",
53
- "./rate-limiter:RateLimiterResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateLimiterResult.html",
54
- "RateRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateRecord.html",
55
- "./rate-limiter:RateRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateRecord.html",
56
- "StreamProperties": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.stream_to_ma_conn.StreamProperties.html",
57
- "./stream-to-ma-conn:StreamProperties": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.stream_to_ma_conn.StreamProperties.html",
58
- "streamToMaConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.stream_to_ma_conn.streamToMaConnection.html",
59
- "./stream-to-ma-conn:streamToMaConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.stream_to_ma_conn.streamToMaConnection.html",
60
- "CreateTrackedListInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_list.CreateTrackedListInit.html",
61
- "./tracked-list:CreateTrackedListInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_list.CreateTrackedListInit.html",
62
- "trackedList": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked_list.trackedList.html",
63
- "./tracked-list:trackedList": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked_list.trackedList.html",
64
- "CreateTrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_map.CreateTrackedMapInit.html",
65
- "./tracked-map:CreateTrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_map.CreateTrackedMapInit.html",
66
- "TrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_map.TrackedMapInit.html",
67
- "./tracked-map:TrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_map.TrackedMapInit.html",
68
- "trackedMap": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked_map.trackedMap.html",
69
- "./tracked-map:trackedMap": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked_map.trackedMap.html"
70
- }