libp2p 0.36.2-d16817c → 0.36.2-da3d19b

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.
Files changed (142) hide show
  1. package/dist/src/address-manager/index.d.ts +2 -1
  2. package/dist/src/address-manager/index.d.ts.map +1 -1
  3. package/dist/src/address-manager/index.js +1 -1
  4. package/dist/src/address-manager/index.js.map +1 -1
  5. package/dist/src/circuit/auto-relay.d.ts.map +1 -1
  6. package/dist/src/circuit/auto-relay.js +7 -6
  7. package/dist/src/circuit/auto-relay.js.map +1 -1
  8. package/dist/src/circuit/circuit/hop.d.ts +1 -1
  9. package/dist/src/circuit/circuit/hop.d.ts.map +1 -1
  10. package/dist/src/circuit/circuit/hop.js +4 -4
  11. package/dist/src/circuit/circuit/hop.js.map +1 -1
  12. package/dist/src/circuit/index.d.ts +1 -1
  13. package/dist/src/circuit/index.d.ts.map +1 -1
  14. package/dist/src/circuit/listener.d.ts +3 -3
  15. package/dist/src/circuit/listener.d.ts.map +1 -1
  16. package/dist/src/circuit/listener.js +10 -2
  17. package/dist/src/circuit/listener.js.map +1 -1
  18. package/dist/src/circuit/transport.d.ts.map +1 -1
  19. package/dist/src/circuit/transport.js +6 -4
  20. package/dist/src/circuit/transport.js.map +1 -1
  21. package/dist/src/config.d.ts.map +1 -1
  22. package/dist/src/config.js +5 -7
  23. package/dist/src/config.js.map +1 -1
  24. package/dist/src/connection-manager/auto-dialler.d.ts +1 -1
  25. package/dist/src/connection-manager/auto-dialler.d.ts.map +1 -1
  26. package/dist/src/connection-manager/auto-dialler.js +4 -4
  27. package/dist/src/connection-manager/auto-dialler.js.map +1 -1
  28. package/dist/src/{dialer → connection-manager/dialer}/auto-dialer.d.ts +2 -0
  29. package/dist/src/connection-manager/dialer/auto-dialer.d.ts.map +1 -0
  30. package/dist/src/connection-manager/dialer/auto-dialer.js +37 -0
  31. package/dist/src/connection-manager/dialer/auto-dialer.js.map +1 -0
  32. package/dist/src/{dialer → connection-manager/dialer}/dial-request.d.ts +2 -2
  33. package/dist/src/connection-manager/dialer/dial-request.d.ts.map +1 -0
  34. package/dist/src/{dialer → connection-manager/dialer}/dial-request.js +1 -1
  35. package/dist/src/connection-manager/dialer/dial-request.js.map +1 -0
  36. package/dist/src/{dialer → connection-manager/dialer}/index.d.ts +37 -8
  37. package/dist/src/connection-manager/dialer/index.d.ts.map +1 -0
  38. package/dist/src/{dialer → connection-manager/dialer}/index.js +10 -23
  39. package/dist/src/connection-manager/dialer/index.js.map +1 -0
  40. package/dist/src/connection-manager/index.d.ts +57 -26
  41. package/dist/src/connection-manager/index.d.ts.map +1 -1
  42. package/dist/src/connection-manager/index.js +78 -40
  43. package/dist/src/connection-manager/index.js.map +1 -1
  44. package/dist/src/connection-manager/latency-monitor.d.ts +1 -1
  45. package/dist/src/connection-manager/latency-monitor.d.ts.map +1 -1
  46. package/dist/src/connection-manager/latency-monitor.js +1 -1
  47. package/dist/src/connection-manager/latency-monitor.js.map +1 -1
  48. package/dist/src/connection-manager/visibility-change-emitter.d.ts +1 -1
  49. package/dist/src/connection-manager/visibility-change-emitter.d.ts.map +1 -1
  50. package/dist/src/connection-manager/visibility-change-emitter.js +1 -1
  51. package/dist/src/connection-manager/visibility-change-emitter.js.map +1 -1
  52. package/dist/src/content-routing/index.d.ts +2 -1
  53. package/dist/src/content-routing/index.d.ts.map +1 -1
  54. package/dist/src/content-routing/index.js.map +1 -1
  55. package/dist/src/dht/dummy-dht.d.ts +1 -1
  56. package/dist/src/dht/dummy-dht.d.ts.map +1 -1
  57. package/dist/src/dht/dummy-dht.js +1 -1
  58. package/dist/src/dht/dummy-dht.js.map +1 -1
  59. package/dist/src/fetch/index.d.ts +1 -1
  60. package/dist/src/fetch/index.d.ts.map +1 -1
  61. package/dist/src/fetch/index.js +1 -1
  62. package/dist/src/fetch/index.js.map +1 -1
  63. package/dist/src/identify/index.d.ts +1 -1
  64. package/dist/src/identify/index.d.ts.map +1 -1
  65. package/dist/src/identify/index.js +4 -4
  66. package/dist/src/identify/index.js.map +1 -1
  67. package/dist/src/index.d.ts +7 -24
  68. package/dist/src/index.d.ts.map +1 -1
  69. package/dist/src/index.js.map +1 -1
  70. package/dist/src/libp2p.d.ts +4 -2
  71. package/dist/src/libp2p.d.ts.map +1 -1
  72. package/dist/src/libp2p.js +57 -43
  73. package/dist/src/libp2p.js.map +1 -1
  74. package/dist/src/metrics/index.d.ts +1 -1
  75. package/dist/src/metrics/index.d.ts.map +1 -1
  76. package/dist/src/metrics/stats.d.ts +1 -1
  77. package/dist/src/metrics/stats.d.ts.map +1 -1
  78. package/dist/src/metrics/stats.js +1 -1
  79. package/dist/src/metrics/stats.js.map +1 -1
  80. package/dist/src/nat-manager.d.ts +1 -1
  81. package/dist/src/nat-manager.d.ts.map +1 -1
  82. package/dist/src/peer-record-updater.d.ts +1 -1
  83. package/dist/src/peer-record-updater.d.ts.map +1 -1
  84. package/dist/src/peer-routing.d.ts +2 -1
  85. package/dist/src/peer-routing.d.ts.map +1 -1
  86. package/dist/src/peer-routing.js.map +1 -1
  87. package/dist/src/ping/index.d.ts +1 -1
  88. package/dist/src/ping/index.d.ts.map +1 -1
  89. package/dist/src/ping/index.js +2 -1
  90. package/dist/src/ping/index.js.map +1 -1
  91. package/dist/src/pubsub/dummy-pubsub.d.ts +1 -1
  92. package/dist/src/pubsub/dummy-pubsub.d.ts.map +1 -1
  93. package/dist/src/pubsub/dummy-pubsub.js +1 -1
  94. package/dist/src/pubsub/dummy-pubsub.js.map +1 -1
  95. package/dist/src/registrar.js +1 -1
  96. package/dist/src/registrar.js.map +1 -1
  97. package/dist/src/transport-manager.d.ts +3 -1
  98. package/dist/src/transport-manager.d.ts.map +1 -1
  99. package/dist/src/transport-manager.js +1 -1
  100. package/dist/src/transport-manager.js.map +1 -1
  101. package/dist/src/upgrader.d.ts +1 -1
  102. package/dist/src/upgrader.d.ts.map +1 -1
  103. package/dist/src/upgrader.js +1 -1
  104. package/dist/src/upgrader.js.map +1 -1
  105. package/package.json +13 -12
  106. package/src/address-manager/index.ts +2 -1
  107. package/src/circuit/auto-relay.ts +8 -6
  108. package/src/circuit/circuit/hop.ts +5 -5
  109. package/src/circuit/index.ts +1 -1
  110. package/src/circuit/listener.ts +18 -5
  111. package/src/circuit/transport.ts +7 -4
  112. package/src/config.ts +5 -7
  113. package/src/connection-manager/auto-dialler.ts +5 -5
  114. package/src/{dialer → connection-manager/dialer}/auto-dialer.ts +23 -4
  115. package/src/{dialer → connection-manager/dialer}/dial-request.ts +4 -4
  116. package/src/{dialer → connection-manager/dialer}/index.ts +48 -37
  117. package/src/connection-manager/index.ts +144 -57
  118. package/src/connection-manager/latency-monitor.ts +1 -1
  119. package/src/connection-manager/visibility-change-emitter.ts +1 -1
  120. package/src/content-routing/index.ts +2 -1
  121. package/src/dht/dummy-dht.ts +1 -1
  122. package/src/fetch/index.ts +2 -2
  123. package/src/identify/index.ts +5 -5
  124. package/src/index.ts +7 -28
  125. package/src/libp2p.ts +68 -49
  126. package/src/metrics/index.ts +1 -1
  127. package/src/metrics/stats.ts +1 -1
  128. package/src/nat-manager.ts +1 -1
  129. package/src/peer-record-updater.ts +1 -1
  130. package/src/peer-routing.ts +2 -1
  131. package/src/ping/index.ts +3 -2
  132. package/src/pubsub/dummy-pubsub.ts +1 -1
  133. package/src/registrar.ts +1 -1
  134. package/src/transport-manager.ts +3 -1
  135. package/src/upgrader.ts +1 -1
  136. package/dist/src/dialer/auto-dialer.d.ts.map +0 -1
  137. package/dist/src/dialer/auto-dialer.js +0 -24
  138. package/dist/src/dialer/auto-dialer.js.map +0 -1
  139. package/dist/src/dialer/dial-request.d.ts.map +0 -1
  140. package/dist/src/dialer/dial-request.js.map +0 -1
  141. package/dist/src/dialer/index.d.ts.map +0 -1
  142. package/dist/src/dialer/index.js.map +0 -1
package/src/libp2p.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { logger } from '@libp2p/logger'
2
- import { AbortOptions, EventEmitter, Startable, CustomEvent, isStartable } from '@libp2p/interfaces'
2
+ import type { AbortOptions } from '@libp2p/interfaces'
3
+ import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events'
4
+ import { Startable, isStartable } from '@libp2p/interfaces/startable'
3
5
  import type { Multiaddr } from '@multiformats/multiaddr'
4
6
  import { MemoryDatastore } from 'datastore-core/memory'
5
7
  import { DefaultPeerRouting } from './peer-routing.js'
@@ -11,7 +13,6 @@ import { DefaultConnectionManager } from './connection-manager/index.js'
11
13
  import { AutoDialler } from './connection-manager/auto-dialler.js'
12
14
  import { Circuit } from './circuit/transport.js'
13
15
  import { Relay } from './circuit/index.js'
14
- import { DefaultDialer } from './dialer/index.js'
15
16
  import { KeyChain } from './keychain/index.js'
16
17
  import { DefaultMetrics } from './metrics/index.js'
17
18
  import { DefaultTransportManager } from './transport-manager.js'
@@ -25,14 +26,15 @@ import { PeerRecordUpdater } from './peer-record-updater.js'
25
26
  import { DHTPeerRouting } from './dht/dht-peer-routing.js'
26
27
  import { PersistentPeerStore } from '@libp2p/peer-store'
27
28
  import { DHTContentRouting } from './dht/dht-content-routing.js'
28
- import { AutoDialer } from './dialer/auto-dialer.js'
29
+ import { AutoDialer } from './connection-manager/dialer/auto-dialer.js'
29
30
  import { Initializable, Components, isInitializable } from '@libp2p/interfaces/components'
30
31
  import type { PeerId } from '@libp2p/interfaces/peer-id'
31
32
  import type { Connection } from '@libp2p/interfaces/connection'
32
33
  import type { PeerRouting } from '@libp2p/interfaces/peer-routing'
33
34
  import type { ContentRouting } from '@libp2p/interfaces/content-routing'
34
35
  import type { PubSub } from '@libp2p/interfaces/pubsub'
35
- import type { ConnectionManager, Registrar, StreamHandler } from '@libp2p/interfaces/registrar'
36
+ import type { Registrar, StreamHandler } from '@libp2p/interfaces/registrar'
37
+ import type { ConnectionManager } from '@libp2p/interfaces/connection-manager'
36
38
  import type { PeerInfo } from '@libp2p/interfaces/peer-info'
37
39
  import type { Libp2p, Libp2pEvents, Libp2pInit, Libp2pOptions } from './index.js'
38
40
  import { validateConfig } from './config.js'
@@ -46,6 +48,7 @@ import { unmarshalPublicKey } from '@libp2p/crypto/keys'
46
48
  import type { Metrics } from '@libp2p/interfaces/metrics'
47
49
  import { DummyDHT } from './dht/dummy-dht.js'
48
50
  import { DummyPubSub } from './pubsub/dummy-pubsub.js'
51
+ import { PeerSet } from '@libp2p/peer-collections'
49
52
 
50
53
  const log = logger('libp2p')
51
54
 
@@ -72,34 +75,40 @@ export class Libp2pNode extends EventEmitter<Libp2pEvents> implements Libp2p {
72
75
  constructor (init: Libp2pInit) {
73
76
  super()
74
77
 
75
- this.services = []
76
78
  this.initializables = []
77
79
  this.started = false
78
80
  this.peerId = init.peerId
79
81
  this.components = new Components({
80
82
  peerId: init.peerId,
81
- datastore: init.datastore ?? new MemoryDatastore()
83
+ datastore: init.datastore ?? new MemoryDatastore(),
84
+ connectionGater: {
85
+ denyDialPeer: async () => await Promise.resolve(false),
86
+ denyDialMultiaddr: async () => await Promise.resolve(false),
87
+ denyInboundConnection: async () => await Promise.resolve(false),
88
+ denyOutboundConnection: async () => await Promise.resolve(false),
89
+ denyInboundEncryptedConnection: async () => await Promise.resolve(false),
90
+ denyOutboundEncryptedConnection: async () => await Promise.resolve(false),
91
+ denyInboundUpgradedConnection: async () => await Promise.resolve(false),
92
+ denyOutboundUpgradedConnection: async () => await Promise.resolve(false),
93
+ filterMultiaddrForPeer: async () => await Promise.resolve(true),
94
+ ...init.connectionGater
95
+ }
82
96
  })
97
+ this.components.setPeerStore(new PersistentPeerStore({
98
+ addressFilter: this.components.getConnectionGater().filterMultiaddrForPeer,
99
+ ...init.peerStore
100
+ }))
101
+
102
+ this.services = [
103
+ this.components
104
+ ]
83
105
 
84
106
  // Create Metrics
85
107
  if (init.metrics.enabled) {
86
- this.metrics = this.components.setMetrics(this.configureComponent(new DefaultMetrics(init.metrics)))
108
+ this.metrics = this.components.setMetrics(new DefaultMetrics(init.metrics))
87
109
  }
88
110
 
89
- this.components.setConnectionGater(this.configureComponent({
90
- denyDialPeer: async () => await Promise.resolve(false),
91
- denyDialMultiaddr: async () => await Promise.resolve(false),
92
- denyInboundConnection: async () => await Promise.resolve(false),
93
- denyOutboundConnection: async () => await Promise.resolve(false),
94
- denyInboundEncryptedConnection: async () => await Promise.resolve(false),
95
- denyOutboundEncryptedConnection: async () => await Promise.resolve(false),
96
- denyInboundUpgradedConnection: async () => await Promise.resolve(false),
97
- denyOutboundUpgradedConnection: async () => await Promise.resolve(false),
98
- filterMultiaddrForPeer: async () => await Promise.resolve(true),
99
- ...init.connectionGater
100
- }))
101
-
102
- this.peerStore = this.components.setPeerStore(this.configureComponent(new PersistentPeerStore(this.components, init.peerStore)))
111
+ this.peerStore = this.components.getPeerStore()
103
112
 
104
113
  this.peerStore.addEventListener('peer', evt => {
105
114
  const { detail: peerData } = evt
@@ -109,32 +118,30 @@ export class Libp2pNode extends EventEmitter<Libp2pEvents> implements Libp2p {
109
118
 
110
119
  // Set up connection protector if configured
111
120
  if (init.connectionProtector != null) {
112
- this.components.setConnectionProtector(this.configureComponent(init.connectionProtector))
121
+ this.components.setConnectionProtector(init.connectionProtector)
113
122
  }
114
123
 
115
124
  // Set up the Upgrader
116
- this.components.setUpgrader(this.configureComponent(new DefaultUpgrader(this.components, {
125
+ this.components.setUpgrader(new DefaultUpgrader(this.components, {
117
126
  connectionEncryption: (init.connectionEncryption ?? []).map(component => this.configureComponent(component)),
118
127
  muxers: (init.streamMuxers ?? []).map(component => this.configureComponent(component))
119
- })))
128
+ }))
120
129
 
121
130
  // Create the Connection Manager
122
- this.connectionManager = this.components.setConnectionManager(this.configureComponent(new DefaultConnectionManager(this.components, init.connectionManager)))
131
+ this.connectionManager = this.components.setConnectionManager(new DefaultConnectionManager(init.connectionManager))
123
132
 
124
133
  // Create the Registrar
125
- this.registrar = this.components.setRegistrar(this.configureComponent(new DefaultRegistrar(this.components)))
134
+ this.registrar = this.components.setRegistrar(new DefaultRegistrar(this.components))
126
135
 
127
136
  // Setup the transport manager
128
- this.components.setTransportManager(this.configureComponent(new DefaultTransportManager(this.components, init.transportManager)))
137
+ this.components.setTransportManager(new DefaultTransportManager(this.components, init.transportManager))
129
138
 
130
139
  // Addresses {listen, announce, noAnnounce}
131
- this.components.setAddressManager(this.configureComponent(new DefaultAddressManager(this.components, init.addresses)))
140
+ this.components.setAddressManager(new DefaultAddressManager(this.components, init.addresses))
132
141
 
133
142
  // update our peer record when addresses change
134
143
  this.configureComponent(new PeerRecordUpdater(this.components))
135
144
 
136
- this.components.setDialer(this.configureComponent(new DefaultDialer(this.components, init.dialer)))
137
-
138
145
  this.configureComponent(new AutoDialler(this.components, {
139
146
  enabled: init.connectionManager.autoDial,
140
147
  minConnections: init.connectionManager.minConnections,
@@ -169,14 +176,14 @@ export class Libp2pNode extends EventEmitter<Libp2pEvents> implements Libp2p {
169
176
 
170
177
  // dht provided components (peerRouting, contentRouting, dht)
171
178
  if (init.dht != null) {
172
- this.dht = this.components.setDHT(this.configureComponent(init.dht))
179
+ this.dht = this.components.setDHT(init.dht)
173
180
  } else {
174
181
  this.dht = new DummyDHT()
175
182
  }
176
183
 
177
184
  // Create pubsub if provided
178
185
  if (init.pubsub != null) {
179
- this.pubsub = this.components.setPubSub(this.configureComponent(init.pubsub))
186
+ this.pubsub = this.components.setPubSub(init.pubsub)
180
187
  } else {
181
188
  this.pubsub = new DummyPubSub()
182
189
  }
@@ -216,7 +223,7 @@ export class Libp2pNode extends EventEmitter<Libp2pEvents> implements Libp2p {
216
223
  this.components.getTransportManager().add(this.configureComponent(new Circuit()))
217
224
 
218
225
  this.configureComponent(new Relay(this.components, {
219
- addressSorter: init.dialer.addressSorter,
226
+ addressSorter: init.connectionManager.addressSorter,
220
227
  ...init.relay
221
228
  }))
222
229
  }
@@ -231,7 +238,8 @@ export class Libp2pNode extends EventEmitter<Libp2pEvents> implements Libp2p {
231
238
 
232
239
  const autoDialer = this.configureComponent(new AutoDialer(this.components, {
233
240
  enabled: init.connectionManager.autoDial !== false,
234
- minConnections: init.connectionManager.minConnections ?? Infinity
241
+ minConnections: init.connectionManager.minConnections,
242
+ dialTimeout: init.connectionManager.dialTimeout ?? 30000
235
243
  }))
236
244
 
237
245
  this.addEventListener('peer:discovery', evt => {
@@ -379,24 +387,41 @@ export class Libp2pNode extends EventEmitter<Libp2pEvents> implements Libp2p {
379
387
  }
380
388
 
381
389
  getConnections (peerId?: PeerId): Connection[] {
382
- if (peerId == null) {
383
- return this.components.getConnectionManager().getConnectionList()
384
- }
385
-
386
390
  return this.components.getConnectionManager().getConnections(peerId)
387
391
  }
388
392
 
389
393
  getPeers (): PeerId[] {
390
- return this.components.getConnectionManager().getConnectionList()
391
- .map(conn => conn.remotePeer)
394
+ const peerSet = new PeerSet()
395
+
396
+ for (const conn of this.components.getConnectionManager().getConnections()) {
397
+ peerSet.add(conn.remotePeer)
398
+ }
399
+
400
+ return Array.from(peerSet)
392
401
  }
393
402
 
394
403
  async dial (peer: PeerId | Multiaddr, options: AbortOptions = {}): Promise<Connection> {
395
- return await this.components.getDialer().dial(peer, options)
404
+ const { id, multiaddrs } = getPeer(peer)
405
+
406
+ await this.components.getPeerStore().addressBook.add(id, multiaddrs)
407
+
408
+ return await this.components.getConnectionManager().openConnection(id, options)
396
409
  }
397
410
 
398
411
  async dialProtocol (peer: PeerId | Multiaddr, protocols: string | string[], options: AbortOptions = {}) {
399
- return await this.components.getDialer().dialProtocol(peer, protocols, options)
412
+ if (protocols == null) {
413
+ throw errCode(new Error('no protocols were provided to open a stream'), codes.ERR_INVALID_PROTOCOLS_FOR_STREAM)
414
+ }
415
+
416
+ protocols = Array.isArray(protocols) ? protocols : [protocols]
417
+
418
+ if (protocols.length === 0) {
419
+ throw errCode(new Error('no protocols were provided to open a stream'), codes.ERR_INVALID_PROTOCOLS_FOR_STREAM)
420
+ }
421
+
422
+ const connection = await this.dial(peer)
423
+
424
+ return await connection.newStream(protocols)
400
425
  }
401
426
 
402
427
  getMultiaddrs (): Multiaddr[] {
@@ -406,13 +431,7 @@ export class Libp2pNode extends EventEmitter<Libp2pEvents> implements Libp2p {
406
431
  async hangUp (peer: PeerId | Multiaddr | string): Promise<void> {
407
432
  const { id } = getPeer(peer)
408
433
 
409
- const connections = this.components.getConnectionManager().getConnections(id)
410
-
411
- await Promise.all(
412
- connections.map(async connection => {
413
- return await connection.close()
414
- })
415
- )
434
+ await this.components.getConnectionManager().closeConnections(id)
416
435
  }
417
436
 
418
437
  /**
@@ -5,7 +5,7 @@ import { METRICS as defaultOptions } from '../constants.js'
5
5
  import { DefaultStats, StatsInit } from './stats.js'
6
6
  import type { ComponentMetricsUpdate, Metrics, Stats, TrackStreamOptions } from '@libp2p/interfaces/metrics'
7
7
  import type { PeerId } from '@libp2p/interfaces/peer-id'
8
- import type { Startable } from '@libp2p/interfaces'
8
+ import type { Startable } from '@libp2p/interfaces/startable'
9
9
  import type { Duplex } from 'it-stream-types'
10
10
 
11
11
  const initialCounters: ['dataReceived', 'dataSent'] = [
@@ -1,4 +1,4 @@
1
- import { CustomEvent, EventEmitter } from '@libp2p/interfaces'
1
+ import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'
2
2
  import { createMovingAverage } from './moving-average.js'
3
3
  // @ts-expect-error no types
4
4
  import retimer from 'retimer'
@@ -7,7 +7,7 @@ import * as pkg from './version.js'
7
7
  import errCode from 'err-code'
8
8
  import { codes } from './errors.js'
9
9
  import { isLoopback } from '@libp2p/utils/multiaddr/is-loopback'
10
- import type { Startable } from '@libp2p/interfaces'
10
+ import type { Startable } from '@libp2p/interfaces/startable'
11
11
  import type { Components } from '@libp2p/interfaces/components'
12
12
 
13
13
  const log = logger('libp2p:nat')
@@ -1,6 +1,6 @@
1
1
  import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record'
2
2
  import type { Components } from '@libp2p/interfaces/components'
3
- import type { Startable } from '@libp2p/interfaces'
3
+ import type { Startable } from '@libp2p/interfaces/startable'
4
4
  import { logger } from '@libp2p/logger'
5
5
  import { protocols } from '@multiformats/multiaddr'
6
6
 
@@ -21,7 +21,8 @@ import {
21
21
  import { setMaxListeners } from 'events'
22
22
  import type { PeerId } from '@libp2p/interfaces/peer-id'
23
23
  import type { PeerRouting } from '@libp2p/interfaces/peer-routing'
24
- import type { AbortOptions, Startable } from '@libp2p/interfaces'
24
+ import type { AbortOptions } from '@libp2p/interfaces'
25
+ import type { Startable } from '@libp2p/interfaces/startable'
25
26
  import type { PeerInfo } from '@libp2p/interfaces/peer-info'
26
27
  import type { Components } from '@libp2p/interfaces/components'
27
28
 
package/src/ping/index.ts CHANGED
@@ -8,7 +8,7 @@ import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
8
8
  import { PROTOCOL_NAME, PING_LENGTH, PROTOCOL_VERSION } from './constants.js'
9
9
  import type { IncomingStreamData } from '@libp2p/interfaces/registrar'
10
10
  import type { PeerId } from '@libp2p/interfaces/peer-id'
11
- import type { Startable } from '@libp2p/interfaces'
11
+ import type { Startable } from '@libp2p/interfaces/startable'
12
12
  import type { Components } from '@libp2p/interfaces/components'
13
13
 
14
14
  const log = logger('libp2p:ping')
@@ -63,7 +63,8 @@ export class PingService implements Startable {
63
63
  async ping (peer: PeerId): Promise<number> {
64
64
  log('dialing %s to %p', this.protocol, peer)
65
65
 
66
- const { stream } = await this.components.getDialer().dialProtocol(peer, this.protocol)
66
+ const connection = await this.components.getConnectionManager().openConnection(peer)
67
+ const { stream } = await connection.newStream([this.protocol])
67
68
  const start = Date.now()
68
69
  const data = randomBytes(PING_LENGTH)
69
70
 
@@ -1,4 +1,4 @@
1
- import { EventEmitter } from '@libp2p/interfaces'
1
+ import { EventEmitter } from '@libp2p/interfaces/events'
2
2
  import type { PeerId } from '@libp2p/interfaces/peer-id'
3
3
  import type { PublishResult, PubSub, PubSubEvents, StrictNoSign, StrictSign } from '@libp2p/interfaces/pubsub'
4
4
  import errCode from 'err-code'
package/src/registrar.ts CHANGED
@@ -192,7 +192,7 @@ export class DefaultRegistrar implements Registrar {
192
192
 
193
193
  for (const { topology, protocols } of this.topologies.values()) {
194
194
  if (supportsProtocol(added, protocols)) {
195
- const connection = this.components.getConnectionManager().getConnection(peerId)
195
+ const connection = this.components.getConnectionManager().getConnections(peerId)[0]
196
196
 
197
197
  if (connection == null) {
198
198
  continue
@@ -5,7 +5,9 @@ import errCode from 'err-code'
5
5
  import type { Listener, Transport, TransportManager, TransportManagerEvents } from '@libp2p/interfaces/transport'
6
6
  import type { Multiaddr } from '@multiformats/multiaddr'
7
7
  import type { Connection } from '@libp2p/interfaces/connection'
8
- import { AbortOptions, CustomEvent, EventEmitter, Startable } from '@libp2p/interfaces'
8
+ import type { AbortOptions } from '@libp2p/interfaces'
9
+ import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'
10
+ import type { Startable } from '@libp2p/interfaces/startable'
9
11
  import type { Components } from '@libp2p/interfaces/components'
10
12
  import { trackedMap } from '@libp2p/tracked-map'
11
13
 
package/src/upgrader.ts CHANGED
@@ -6,7 +6,7 @@ import { pipe } from 'it-pipe'
6
6
  import mutableProxy from 'mutable-proxy'
7
7
  import { codes } from './errors.js'
8
8
  import { createConnection } from '@libp2p/connection'
9
- import { CustomEvent, EventEmitter } from '@libp2p/interfaces'
9
+ import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'
10
10
  import { peerIdFromString } from '@libp2p/peer-id'
11
11
  import type { Connection, ProtocolStream, Stream } from '@libp2p/interfaces/connection'
12
12
  import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interfaces/connection-encrypter'
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-dialer.d.ts","sourceRoot":"","sources":["../../../src/dialer/auto-dialer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAI/D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAQ;gBAE1B,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc;IAMlD,MAAM,CAAE,GAAG,EAAE,WAAW,CAAC,QAAQ,CAAC;CAiB1C"}
@@ -1,24 +0,0 @@
1
- import { logger } from '@libp2p/logger';
2
- const log = logger('libp2p:dialer:auto-dialer');
3
- export class AutoDialer {
4
- constructor(components, init) {
5
- this.components = components;
6
- this.enabled = init.enabled;
7
- this.minConnections = init.minConnections;
8
- }
9
- handle(evt) {
10
- const { detail: peer } = evt;
11
- // If auto dialing is on and we have no connection to the peer, check if we should dial
12
- if (this.enabled && this.components.getConnectionManager().getConnection(peer.id) == null) {
13
- const minConnections = this.minConnections ?? 0;
14
- if (minConnections > this.components.getConnectionManager().getConnectionList().length) {
15
- log('auto-dialing discovered peer %p', peer.id);
16
- void this.components.getDialer().dial(peer.id)
17
- .catch(err => {
18
- log.error('could not connect to discovered peer %p with %o', peer.id, err);
19
- });
20
- }
21
- }
22
- }
23
- }
24
- //# sourceMappingURL=auto-dialer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-dialer.js","sourceRoot":"","sources":["../../../src/dialer/auto-dialer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGvC,MAAM,GAAG,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAA;AAO/C,MAAM,OAAO,UAAU;IAKrB,YAAa,UAAsB,EAAE,IAAoB;QACvD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC3B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;IAC3C,CAAC;IAEM,MAAM,CAAE,GAA0B;QACvC,MAAM,EAAE,MAAM,E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