helia-coord 1.2.2 → 1.2.3

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.
@@ -13,6 +13,9 @@ class PeerUseCases {
13
13
  }
14
14
  }
15
15
 
16
+ // 11/3/23 CT: I don't believe this function is called. I believe it can be
17
+ // deprecated and deleted.
18
+ //
16
19
  // Connect to a peer through available circuit relays. This ensures a short
17
20
  // path between peers, *before* broadcasting the OrbitDB message to them.
18
21
  // This method is primarily used by sendPrivateMessage() to allow for fast-
@@ -308,9 +308,14 @@ class ThisNodeUseCases {
308
308
  // If the connection was successful, break out of the relay loop.
309
309
  // Otherwise try to connect through the next relay.
310
310
  if (connected) {
311
- // this.adapters.log.statusLog(0,
312
- // 'Successfully connected to peer through circuit relay.'
313
- // )
311
+ this.adapters.log.statusLog(2,
312
+ `Successfully connected to peer ${thisPeer} through v2 circuit relay ${thisRelay.multiaddr}.`
313
+ )
314
+
315
+ // Add the connection multiaddr to the peer, so that we can see
316
+ // exactly how we're connected to the peer.
317
+ const thisPeerData = this.thisNode.peerData.filter(x => x.from === thisPeer)
318
+ thisPeerData[0].data.connectionAddr = multiaddr
314
319
 
315
320
  // Break out of the loop once we've made a successful connection.
316
321
  break
@@ -333,7 +338,18 @@ class ThisNodeUseCases {
333
338
  // Attempt to connect to the node through a circuit relay.
334
339
  connected = await this.adapters.ipfs.connectToPeer({ multiaddr })
335
340
 
336
- if (connected) break
341
+ if (connected) {
342
+ this.adapters.log.statusLog(2,
343
+ `Successfully connected to peer ${thisPeer} through v1 circuit relay ${thisV1Relay.multiaddr}.`
344
+ )
345
+
346
+ // Add the connection multiaddr to the peer, so that we can see
347
+ // exactly how we're connected to the peer.
348
+ const thisPeerData = this.thisNode.peerData.filter(x => x.from === thisPeer)
349
+ thisPeerData[0].data.connectionAddr = multiaddr
350
+
351
+ break
352
+ }
337
353
  }
338
354
  }
339
355
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "helia-coord",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "A JS library for helping IPFS peers coordinate, find a common interest, and stay connected around that interest.",
5
5
  "main": "./index.js",
6
6
  "type": "module",
@@ -217,7 +217,7 @@ describe('#thisNode-Use-Cases', () => {
217
217
  // Add a peer that is not in the list of connected peers.
218
218
  const ipfsId = 'QmbyYXKbnAmMbMGo8LRBZ58jYs58anqUzY1m4jxDmhDsje'
219
219
  uut.thisNode.peerList = [ipfsId]
220
- uut.thisNode.peerData = [{ from: ipfsId }]
220
+ uut.thisNode.peerData = [{ from: ipfsId, data: {} }]
221
221
 
222
222
  // Add a peer
223
223
  await uut.addSubnetPeer(mockData.announceObj)
@@ -241,7 +241,7 @@ describe('#thisNode-Use-Cases', () => {
241
241
  // Add a peer that is not in the list of connected peers.
242
242
  const ipfsId = 'QmbyYXKbnAmMbMGo8LRBZ58jYs58anqUzY1m4jxDmhDsje'
243
243
  uut.thisNode.peerList = [ipfsId]
244
- uut.thisNode.peerData = [{ from: ipfsId }]
244
+ uut.thisNode.peerData = [{ from: ipfsId, data: {} }]
245
245
 
246
246
  // Add a peer
247
247
  await uut.addSubnetPeer(mockData.announceObj)