fix(peers): Adding connectionAddr to /ipfs/peers

This commit is contained in:
Chris Troutner
2023-11-03 14:33:58 -07:00
parent 1c61f150b1
commit 3eb88d4076
4 changed files with 19 additions and 15 deletions
+7 -7
View File
@@ -20,7 +20,7 @@
"datastore-fs": "9.1.5",
"glob": "7.1.6",
"helia": "2.0.3",
"helia-coord": "1.2.2",
"helia-coord": "1.2.4",
"jsonrpc-lite": "2.2.0",
"jsonwebtoken": "8.5.1",
"jwt-bch-lib": "1.3.0",
@@ -8451,9 +8451,9 @@
}
},
"node_modules/helia-coord": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/helia-coord/-/helia-coord-1.2.2.tgz",
"integrity": "sha512-klV/8IWso2V7uvcs0Pm3w4WPmP5ZKfCFHqLE1Jrun4j0aTLgxeFqLWjFgwKSdLCKXYoa/c8c4BJ+16+/pDwqyg==",
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/helia-coord/-/helia-coord-1.2.4.tgz",
"integrity": "sha512-DM0SZGyDK7RUjuWlRKzxuP3iRFNqJTD3n8z5A163LAeztcWSUlJMq489AG6jJAy4TYRPnXOULTAGPf1cj+5qzQ==",
"dependencies": {
"@chris.troutner/retry-queue": "1.0.8",
"@multiformats/multiaddr": "12.1.8",
@@ -25797,9 +25797,9 @@
}
},
"helia-coord": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/helia-coord/-/helia-coord-1.2.2.tgz",
"integrity": "sha512-klV/8IWso2V7uvcs0Pm3w4WPmP5ZKfCFHqLE1Jrun4j0aTLgxeFqLWjFgwKSdLCKXYoa/c8c4BJ+16+/pDwqyg==",
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/helia-coord/-/helia-coord-1.2.4.tgz",
"integrity": "sha512-DM0SZGyDK7RUjuWlRKzxuP3iRFNqJTD3n8z5A163LAeztcWSUlJMq489AG6jJAy4TYRPnXOULTAGPf1cj+5qzQ==",
"requires": {
"@chris.troutner/retry-queue": "1.0.8",
"@multiformats/multiaddr": "12.1.8",
+1 -1
View File
@@ -35,7 +35,7 @@
"datastore-fs": "9.1.5",
"glob": "7.1.6",
"helia": "2.0.3",
"helia-coord": "1.2.2",
"helia-coord": "1.2.4",
"jsonrpc-lite": "2.2.0",
"jsonwebtoken": "8.5.1",
"jwt-bch-lib": "1.3.0",
+5 -1
View File
@@ -114,6 +114,7 @@ class IPFS {
x.from.includes(thisPeer.peer)
)
thisPeerData = thisPeerData[0]
// console.log('thisPeerData: ', thisPeerData)
// Skip if peerData for this IPFS peer could not be found.
// if (!thisPeerData) continue
@@ -125,6 +126,7 @@ class IPFS {
thisPeer.name = thisPeerData.data.jsonLd.name
thisPeer.protocol = thisPeerData.data.jsonLd.protocol
thisPeer.version = thisPeerData.data.jsonLd.version
thisPeer.connectionAddr = thisPeerData.data.connectionAddr
if (showAll) {
// Add all the peer data.
@@ -182,7 +184,9 @@ class IPFS {
thisRelay.description = thisPeer[0].data.jsonLd.description
}
return relayData
const v1Relays = this.config.v1Relays
return { v2Relays: relayData, v1Relays }
} catch (err) {
console.error('Error in getRelays(): ', err)
throw err
@@ -195,12 +195,12 @@ describe('#IPFS-adapter-index', () => {
const result = uut.getRelays()
// console.log('result: ', result)
assert.isArray(result)
assert.equal(result.length, 2)
assert.property(result[0], 'name')
assert.property(result[0], 'description')
assert.property(result[1], 'name')
assert.property(result[1], 'description')
assert.isArray(result.v2Relays)
assert.equal(result.v2Relays.length, 2)
assert.property(result.v2Relays[0], 'name')
assert.property(result.v2Relays[0], 'description')
assert.property(result.v2Relays[1], 'name')
assert.property(result.v2Relays[1], 'description')
})
it('should catch, report, and throw errors', () => {