libp2p 2.7.1 → 2.7.2-6f8cfeafb

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.
@@ -260,17 +260,17 @@ export class AddressManager implements AddressManagerInterface {
260
260
  }
261
261
 
262
262
  if (options?.type === 'dns-mapping' || this.dnsMappings.has(addr)) {
263
- const dnsMapingStartingConfidence = this.dnsMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL)
263
+ const dnsMappingStartingConfidence = this.dnsMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL)
264
264
 
265
- if (!dnsMapingStartingConfidence && startingConfidence) {
265
+ if (!dnsMappingStartingConfidence && startingConfidence) {
266
266
  startingConfidence = false
267
267
  }
268
268
  }
269
269
 
270
270
  if (options?.type === 'ip-mapping' || this.ipMappings.has(addr)) {
271
- const ipMapingStartingConfidence = this.ipMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL)
271
+ const ipMappingStartingConfidence = this.ipMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL)
272
272
 
273
- if (!ipMapingStartingConfidence && startingConfidence) {
273
+ if (!ipMappingStartingConfidence && startingConfidence) {
274
274
  startingConfidence = false
275
275
  }
276
276
  }
@@ -317,17 +317,17 @@ export class AddressManager implements AddressManagerInterface {
317
317
  }
318
318
 
319
319
  if (this.dnsMappings.has(addr)) {
320
- const dnsMapingStartingConfidence = this.dnsMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry)
320
+ const dnsMappingStartingConfidence = this.dnsMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry)
321
321
 
322
- if (!dnsMapingStartingConfidence && startingConfidence) {
322
+ if (!dnsMappingStartingConfidence && startingConfidence) {
323
323
  startingConfidence = false
324
324
  }
325
325
  }
326
326
 
327
327
  if (this.ipMappings.has(addr)) {
328
- const ipMapingStartingConfidence = this.ipMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry)
328
+ const ipMappingStartingConfidence = this.ipMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry)
329
329
 
330
- if (!ipMapingStartingConfidence && startingConfidence) {
330
+ if (!ipMappingStartingConfidence && startingConfidence) {
331
331
  startingConfidence = false
332
332
  }
333
333
  }
@@ -11,7 +11,7 @@ const CODEC_IP6 = 0x29
11
11
  * insecure websockets by default.
12
12
  *
13
13
  * Browsers are severely limited in their resource usage so don't waste time
14
- * trying to dial undiallable addresses, and they also print verbose error
14
+ * trying to dial undialable addresses, and they also print verbose error
15
15
  * messages when making connections over insecure transports which causes
16
16
  * confusion.
17
17
  */
@@ -11,14 +11,14 @@ import type { Address } from '@libp2p/interface'
11
11
  */
12
12
  // eslint-disable-next-line complexity
13
13
  export function reliableTransportsFirst (a: Address, b: Address): -1 | 0 | 1 {
14
- const isATCP = TCP.exactMatch(a.multiaddr)
15
- const isBTCP = TCP.exactMatch(b.multiaddr)
14
+ const isATcp = TCP.exactMatch(a.multiaddr)
15
+ const isBTcp = TCP.exactMatch(b.multiaddr)
16
16
 
17
- if (isATCP && !isBTCP) {
17
+ if (isATcp && !isBTcp) {
18
18
  return -1
19
19
  }
20
20
 
21
- if (!isATCP && isBTCP) {
21
+ if (!isATcp && isBTcp) {
22
22
  return 1
23
23
  }
24
24
 
@@ -216,7 +216,7 @@ export class DialQueue {
216
216
 
217
217
  try {
218
218
  // load addresses from address book, resolve and dnsaddrs, filter
219
- // undiallables, add peer IDs, etc
219
+ // undialables, add peer IDs, etc
220
220
  addrsToDial = await this.calculateMultiaddrs(peerId, options?.multiaddrs, {
221
221
  ...options,
222
222
  signal
@@ -449,17 +449,17 @@ export class DialQueue {
449
449
  throw new NoValidAddressesError('The dial request has no valid addresses')
450
450
  }
451
451
 
452
- const gatedAdrs: Address[] = []
452
+ const gatedAddrs: Address[] = []
453
453
 
454
454
  for (const addr of dedupedMultiaddrs) {
455
455
  if (this.components.connectionGater.denyDialMultiaddr != null && await this.components.connectionGater.denyDialMultiaddr(addr.multiaddr)) {
456
456
  continue
457
457
  }
458
458
 
459
- gatedAdrs.push(addr)
459
+ gatedAddrs.push(addr)
460
460
  }
461
461
 
462
- const sortedGatedAddrs = this.addressSorter == null ? defaultAddressSorter(gatedAdrs) : gatedAdrs.sort(this.addressSorter)
462
+ const sortedGatedAddrs = this.addressSorter == null ? defaultAddressSorter(gatedAddrs) : gatedAddrs.sort(this.addressSorter)
463
463
 
464
464
  // make sure we actually have some addresses to dial
465
465
  if (sortedGatedAddrs.length === 0) {
package/src/errors.ts CHANGED
@@ -66,6 +66,13 @@ export class NoValidAddressesError extends Error {
66
66
  }
67
67
  }
68
68
 
69
+ export class NoSupportedAddressesError extends Error {
70
+ constructor (message = 'No supported addresses') {
71
+ super(message)
72
+ this.name = 'NoSupportedAddressesError'
73
+ }
74
+ }
75
+
69
76
  export class ConnectionInterceptedError extends Error {
70
77
  constructor (message = 'Connection intercepted') {
71
78
  super(message)
package/src/index.ts CHANGED
@@ -102,7 +102,7 @@ export interface Libp2pInit<T extends ServiceMap = ServiceMap> {
102
102
 
103
103
  /**
104
104
  * Connection encrypters ensure that data sent over connections cannot be
105
- * eavesdropped on, and that the remote peer posesses the private key that
105
+ * eavesdropped on, and that the remote peer possesses the private key that
106
106
  * corresponds to the public key that it's Peer ID is derived from.
107
107
  */
108
108
  connectionEncrypters?: Array<(components: Components) => ConnectionEncrypter>
package/src/libp2p.ts CHANGED
@@ -67,7 +67,7 @@ export class Libp2p<T extends ServiceMap = ServiceMap> extends TypedEventEmitter
67
67
  this.services = {}
68
68
 
69
69
  const nodeInfoName = init.nodeInfo?.name ?? pkg.name
70
- const nodeInfoVersion = init.nodeInfo?.version ?? pkg.name
70
+ const nodeInfoVersion = init.nodeInfo?.version ?? pkg.version
71
71
 
72
72
  // @ts-expect-error defaultComponents is missing component types added later
73
73
  const components = this.components = defaultComponents({
@@ -133,7 +133,7 @@ export class RandomWalk extends TypedEventEmitter<RandomWalkEvents> implements R
133
133
 
134
134
  this.log('walk iteration for %b and %d walkers finished, found %d peers', data, this.walkers, found)
135
135
  } catch (err) {
136
- this.log.error('randomwalk errored', err)
136
+ this.log.error('random walk errored', err)
137
137
 
138
138
  this.safeDispatchEvent('walk:error', {
139
139
  detail: err
@@ -144,7 +144,7 @@ export class RandomWalk extends TypedEventEmitter<RandomWalkEvents> implements R
144
144
  this.log('no walkers left, ended walk')
145
145
  })
146
146
  .catch(err => {
147
- this.log.error('randomwalk errored', err)
147
+ this.log.error('random walk errored', err)
148
148
  })
149
149
  .finally(() => {
150
150
  this.log('finished walk, found %d peers after %dms', found, Date.now() - start)
package/src/upgrader.ts CHANGED
@@ -413,7 +413,7 @@ export class DefaultUpgrader implements Upgrader {
413
413
  }
414
414
 
415
415
  // after the handshake the returned stream can have early data so override
416
- // the souce/sink
416
+ // the source/sink
417
417
  muxedStream.source = stream.source
418
418
  muxedStream.sink = stream.sink
419
419
  muxedStream.protocol = protocol
@@ -434,7 +434,7 @@ export class DefaultUpgrader implements Upgrader {
434
434
  }
435
435
 
436
436
  // If a protocol stream has been successfully negotiated and is to be passed to the application,
437
- // the peerstore should ensure that the peer is registered with that protocol
437
+ // the peer store should ensure that the peer is registered with that protocol
438
438
  await this.components.peerStore.merge(remotePeer, {
439
439
  protocols: [protocol]
440
440
  })
@@ -499,13 +499,13 @@ export class DefaultUpgrader implements Upgrader {
499
499
  }
500
500
 
501
501
  // If a protocol stream has been successfully negotiated and is to be passed to the application,
502
- // the peerstore should ensure that the peer is registered with that protocol
502
+ // the peer store should ensure that the peer is registered with that protocol
503
503
  await this.components.peerStore.merge(remotePeer, {
504
504
  protocols: [protocol]
505
505
  })
506
506
 
507
507
  // after the handshake the returned stream can have early data so override
508
- // the souce/sink
508
+ // the source/sink
509
509
  muxedStream.source = stream.source
510
510
  muxedStream.sink = stream.sink
511
511
  muxedStream.protocol = protocol
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const version = '2.7.1'
1
+ export const version = '2.7.2-6f8cfeafb'
2
2
  export const name = 'js-libp2p'
@@ -1,21 +0,0 @@
1
- {
2
- "AddressFilter": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.AddressFilter.html",
3
- "AddressManagerInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.AddressManagerInit.html",
4
- "ConnectionManagerInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.ConnectionManagerInit.html",
5
- "ConnectionMonitorInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.ConnectionMonitorInit.html",
6
- "Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2pInit.html",
7
- ".:Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2pInit.html",
8
- "TransportManagerInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.TransportManagerInit.html",
9
- "Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.index.Libp2pOptions.html",
10
- ".:Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.index.Libp2pOptions.html",
11
- "ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.index.ServiceFactoryMap.html",
12
- ".:ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.index.ServiceFactoryMap.html",
13
- "createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.index.createLibp2p.html",
14
- ".:createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.index.createLibp2p.html",
15
- "userAgent": "https://libp2p.github.io/js-libp2p/functions/libp2p.user_agent.userAgent.html",
16
- "./user-agent:userAgent": "https://libp2p.github.io/js-libp2p/functions/libp2p.user_agent.userAgent.html",
17
- "name": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.name.html",
18
- "./version:name": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.name.html",
19
- "version": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.version.html",
20
- "./version:version": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.version.html"
21
- }