Skip to content

Commit 67536b4

Browse files
authored
chore: update ipfs-http-client to the latest version (#23)
* chore: update ipfs-http-client to the latest version * chore: specify minimum http client version
1 parent c777434 commit 67536b4

File tree

4 files changed

+39
-16
lines changed

4 files changed

+39
-16
lines changed

.aegir.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
'use strict'
22

3-
const createServer = require('ipfsd-ctl').createServer
4-
5-
const server = createServer()
3+
const { createServer } = require('ipfsd-ctl')
4+
let server
65

76
module.exports = {
87
hooks: {
98
browser: {
10-
pre: () => server.start(),
9+
pre: async () => {
10+
server = createServer({
11+
host: '127.0.0.1',
12+
port: 57483
13+
}, {
14+
type: 'go',
15+
ipfsHttpModule: require('ipfs-http-client'),
16+
ipfsBin: require('go-ipfs-dep').path(),
17+
test: true
18+
})
19+
20+
await server.start()
21+
},
1122
post: () => server.stop()
1223
}
1324
}

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
"coverage": "aegir coverage"
1919
},
2020
"devDependencies": {
21-
"aegir": "^21.0.2",
21+
"aegir": "^21.4.5",
2222
"chai": "^4.2.0",
2323
"dirty-chai": "^2.0.1",
24-
"go-ipfs-dep": "^0.4.23",
25-
"ipfsd-ctl": "^0.44.1"
24+
"go-ipfs-dep": "0.4.23-3",
25+
"ipfs-utils": "^1.2.1",
26+
"ipfsd-ctl": "^3.0.0"
2627
},
2728
"dependencies": {
2829
"debug": "^4.1.1",
29-
"ipfs-http-client": "^42.0.0",
30+
"ipfs-http-client": "^43.0.1",
3031
"p-queue": "^6.2.1",
3132
"peer-id": "~0.13.5",
3233
"peer-info": "^0.17.1"

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ class DelegatedPeerRouting {
4949
try {
5050
return await this._httpQueue.add(async () => {
5151
const { addrs } = await this.dht.findPeer(id, {
52-
timeout: `${options.timeout}ms`// The api requires specification of the time unit (s/ms)
52+
searchParams: {
53+
timeout: `${options.timeout}ms`// The api requires specification of the time unit (s/ms)
54+
}
5355
})
5456

5557
const peerInfo = new PeerInfo(PeerId.createFromCID(id))

test/index.spec.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,29 @@
44
const chai = require('chai')
55
const { expect } = chai
66
chai.use(require('dirty-chai'))
7-
const IPFSFactory = require('ipfsd-ctl')
7+
const { createFactory } = require('ipfsd-ctl')
88
const PeerID = require('peer-id')
9+
const { isNode } = require('ipfs-utils/src/env')
910

1011
const DelegatedPeerRouting = require('../src')
11-
const factory = IPFSFactory.create({ type: 'go' })
12+
const factory = createFactory({
13+
type: 'go',
14+
ipfsHttpModule: require('ipfs-http-client'),
15+
ipfsBin: isNode ? require('go-ipfs-dep').path() : undefined,
16+
test: true,
17+
endpoint: 'http://localhost:57483'
18+
})
1219

1320
async function spawnNode (boostrap = []) {
1421
const node = await factory.spawn({
1522
// Lock down the nodes so testing can be deterministic
16-
config: {
17-
Bootstrap: boostrap,
18-
Discovery: {
19-
MDNS: {
20-
Enabled: false
23+
ipfsOptions: {
24+
config: {
25+
Bootstrap: boostrap,
26+
Discovery: {
27+
MDNS: {
28+
Enabled: false
29+
}
2130
}
2231
}
2332
}

0 commit comments

Comments
 (0)