Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1102 from ipfs/upgrade-multiaddrs
Browse files Browse the repository at this point in the history
chore: update multiaddrs module

BREAKING CHANGE: The port returned from `ipfs.getEndpointConfig()` is now a number.  The multiaddr module has also been upgraded to v7 which changes the protocol name of `ipfs` to `p2p`
  • Loading branch information
achingbrain authored Sep 11, 2019
2 parents fadc601 + 919bcae commit 74c55ab
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const createServer = require('ipfsd-ctl').createServer
const server = createServer()

module.exports = {
bundlesize: { maxSize: '240kB' },
bundlesize: { maxSize: '245kB' },
webpack: {
resolve: {
mainFields: ['browser', 'main']
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"ky": "^0.13.0",
"ky-universal": "^0.3.0",
"lru-cache": "^5.1.1",
"multiaddr": "^6.0.6",
"multiaddr": "^7.1.0",
"multibase": "~0.6.0",
"multicodec": "~0.5.1",
"multihashes": "~0.4.14",
Expand Down
18 changes: 9 additions & 9 deletions test/constructor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ describe('ipfs-http-client constructor tests', () => {

it('opts', () => {
const host = 'wizard.world'
const port = '999'
const port = 999
const protocol = 'https'
const ipfs = ipfsClient({ host, port, protocol })
expectConfig(ipfs, { host, port, protocol })
})

it('multiaddr dns4 string (implicit http)', () => {
const host = 'foo.com'
const port = '1001'
const port = 1001
const protocol = 'http' // default to http if not specified in multiaddr
const addr = `/dns4/${host}/tcp/${port}`
const ipfs = ipfsClient(addr)
Expand All @@ -41,7 +41,7 @@ describe('ipfs-http-client constructor tests', () => {

it('multiaddr dns4 string (explicit https)', () => {
const host = 'foo.com'
const port = '1001'
const port = 1001
const protocol = 'https'
const addr = `/dns4/${host}/tcp/${port}/${protocol}`
const ipfs = ipfsClient(addr)
Expand All @@ -50,7 +50,7 @@ describe('ipfs-http-client constructor tests', () => {

it('multiaddr dns4 string, explicit https in opts', () => {
const host = 'foo.com'
const port = '1001'
const port = 1001
const protocol = 'https'
const addr = `/dns4/${host}/tcp/${port}`
const ipfs = ipfsClient(addr, { protocol })
Expand All @@ -59,7 +59,7 @@ describe('ipfs-http-client constructor tests', () => {

it('multiaddr ipv4 string (implicit http)', () => {
const host = '101.101.101.101'
const port = '1001'
const port = 1001
const protocol = 'http'
const addr = `/ip4/${host}/tcp/${port}`
const ipfs = ipfsClient(addr)
Expand All @@ -68,7 +68,7 @@ describe('ipfs-http-client constructor tests', () => {

it('multiaddr ipv4 string (explicit https)', () => {
const host = '101.101.101.101'
const port = '1001'
const port = 1001
const protocol = 'https'
const addr = `/ip4/${host}/tcp/${port}/${protocol}`
const ipfs = ipfsClient(addr)
Expand All @@ -77,22 +77,22 @@ describe('ipfs-http-client constructor tests', () => {

it('multiaddr instance', () => {
const host = 'ace.place'
const port = '1001'
const port = 1001
const addr = multiaddr(`/dns4/${host}/tcp/${port}`)
const ipfs = ipfsClient(addr)
expectConfig(ipfs, { host, port })
})

it('host and port strings', () => {
const host = '1.1.1.1'
const port = '9999'
const port = 9999
const ipfs = ipfsClient(host, port)
expectConfig(ipfs, { host, port })
})

it('host, port and api path', () => {
const host = '10.100.100.255'
const port = '9999'
const port = 9999
const apiPath = '/future/api/v1/'
const ipfs = ipfsClient(host, port, { 'api-path': apiPath })
expectConfig(ipfs, { host, port, apiPath })
Expand Down
2 changes: 1 addition & 1 deletion test/node/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('.swarm.peers', function () {
expect(res).to.be.a('array')
expect(res.length).to.equal(1)
expect(res[0].error).to.not.exist()
expect(res[0].addr.toString()).to.equal('/ip4/73.109.217.59/tcp/49311/ipfs/QmWjxEGC7BthJrCf7QTModrcsRweHbupdPTY4oGMVoDZXm')
expect(res[0].addr.toString()).to.equal('/ip4/73.109.217.59/tcp/49311/p2p/QmWjxEGC7BthJrCf7QTModrcsRweHbupdPTY4oGMVoDZXm')
expect(res[0].peer.toB58String()).to.equal('QmWjxEGC7BthJrCf7QTModrcsRweHbupdPTY4oGMVoDZXm')
expect(scope.isDone()).to.equal(true)
})
Expand Down

0 comments on commit 74c55ab

Please sign in to comment.