Skip to content

Commit 86e061b

Browse files
chore: change ipfs to p2p in production and test code
1 parent ed80486 commit 86e061b

11 files changed

+19
-19
lines changed

pdd/pdd-the-ipfs-bundle--story-1--peer-a.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test('story 1 - peerA', (t) => {
5959
t.ifErr(err, 'created Node successfully')
6060
t.ok(node.isStarted(), 'PeerA is Running')
6161

62-
const peerBAddr = `/ip4/127.0.0.1/tcp/10001/ipfs/${PeerB.id}`
62+
const peerBAddr = `/ip4/127.0.0.1/tcp/10001/p2p/${PeerB.id}`
6363

6464
node.handle('/time/1.0.0', (protocol, conn) => {
6565
pull(

pdd/pdd-the-ipfs-bundle--story-1--peer-b.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test('story 1 - peerA', (t) => {
5959
t.ifErr(err, 'created Node successfully')
6060
t.ok(node.isStarted(), 'PeerB is Running')
6161

62-
const peerAAddr = `/ip4/127.0.0.1/tcp/10000/ipfs/${PeerA.id}`
62+
const peerAAddr = `/ip4/127.0.0.1/tcp/10000/p2p/${PeerA.id}`
6363

6464
node.handle('/echo/1.0.0', (protocol, conn) => {
6565
pull(

pdd/pdd-transport--story-1--peer-a.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test('story 1 - peerA', (t) => {
3333
t.ifErr(err, 'created Node')
3434
t.ok(node.isStarted(), 'PeerA is running')
3535

36-
const PeerBAddr = `/ip4/127.0.0.1/tcp/10001/ipfs/${PeerB.id}`
36+
const PeerBAddr = `/ip4/127.0.0.1/tcp/10001/p2p/${PeerB.id}`
3737

3838
node.dial(PeerBAddr, '/echo/1.0.0', (err, conn) => {
3939
t.ifErr(err, 'dial successful')

pdd/pdd-transport--story-2--peer-a.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test('story 2 - peerA', (t) => {
3333
t.ifErr(err, 'created Node')
3434
t.ok(node.isStarted(), 'PeerA is running')
3535

36-
const PeerBAddr = `/ip4/127.0.0.1/tcp/10001/ws/ipfs/${PeerB.id}`
36+
const PeerBAddr = `/ip4/127.0.0.1/tcp/10001/p2p/${PeerB.id}`
3737

3838
node.dial(PeerBAddr, '/echo/1.0.0', (err, conn) => {
3939
t.ifErr(err, 'dial successful')

pdd/pdd-transport--story-3--peer-a.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test('story 3 - peerA', (t) => {
3232
t.ifErr(err, 'created Node')
3333
t.ok(node.isStarted(), 'PeerA is running')
3434

35-
const PeerBAddr = `/ip4/127.0.0.1/tcp/10001/ws/ipfs/${PeerB.id}`
35+
const PeerBAddr = `/ip4/127.0.0.1/tcp/10001/p2p/${PeerB.id}`
3636

3737
setTimeout(() => node.dial(PeerBAddr, '/echo/1.0.0', (err, conn) => {
3838
t.ok(err, 'dial failed')

pdd/pdd-transport--story-3--peer-b.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test('story 3 - peerB', (t) => {
3232
t.ifErr(err, 'created Node')
3333
t.ok(node.isStarted(), 'PeerA is running')
3434

35-
const PeerAAddr = `/ip4/127.0.0.1/tcp/10000/ws/ipfs/${PeerA.id}`
35+
const PeerAAddr = `/ip4/127.0.0.1/tcp/10000/p2p/${PeerA.id}`
3636

3737
setTimeout(() => node.dial(PeerAAddr, '/echo/1.0.0', (err, conn) => {
3838
t.ok(err, 'dial failed')

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ class Node extends EventEmitter {
330330
this.peerInfo.multiaddrs.toArray().forEach((ma) => {
331331
if (!ma.getPeerId()) {
332332
maOld.push(ma)
333-
maNew.push(ma.encapsulate('/ipfs/' + this.peerInfo.id.toB58String()))
333+
maNew.push(ma.encapsulate('/p2p/' + this.peerInfo.id.toB58String()))
334334
}
335335
})
336336
this.peerInfo.multiaddrs.replace(maOld, maNew)

test/circuit-relay.node.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ describe('circuit relay', () => {
117117
// set up node with TCP and listening on relay1
118118
(cb) => setupNode([
119119
'/ip4/0.0.0.0/tcp/0',
120-
`/ipfs/${relayNode1.peerInfo.id.toB58String()}/p2p-circuit`
120+
`/p2p/${relayNode1.peerInfo.id.toB58String()}/p2p-circuit`
121121
], {
122122
config: {
123123
relay: {
@@ -131,7 +131,7 @@ describe('circuit relay', () => {
131131
// set up node with TCP and listening on relay2 over TCP transport
132132
(cb) => setupNode([
133133
'/ip4/0.0.0.0/tcp/0',
134-
`/ip4/0.0.0.0/tcp/0/ipfs/${relayNode2.peerInfo.id.toB58String()}/p2p-circuit`
134+
`/ip4/0.0.0.0/tcp/0/p2p/${relayNode2.peerInfo.id.toB58String()}/p2p-circuit`
135135
], {
136136
config: {
137137
relay: {
@@ -195,7 +195,7 @@ describe('circuit relay', () => {
195195

196196
tryEcho(conn, () => {
197197
const addr = multiaddr(handlerSpies[0].args[2][0].dstPeer.addrs[0]).toString()
198-
expect(addr).to.equal(`/ipfs/${nodeTCP1.peerInfo.id.toB58String()}`)
198+
expect(addr).to.equal(`/p2p/${nodeTCP1.peerInfo.id.toB58String()}`)
199199
done()
200200
})
201201
})
@@ -208,7 +208,7 @@ describe('circuit relay', () => {
208208

209209
tryEcho(conn, () => {
210210
const addr = multiaddr(handlerSpies[1].args[2][0].dstPeer.addrs[0]).toString()
211-
expect(addr).to.equal(`/ipfs/${nodeTCP2.peerInfo.id.toB58String()}`)
211+
expect(addr).to.equal(`/p2p/${nodeTCP2.peerInfo.id.toB58String()}`)
212212
done()
213213
})
214214
})

test/content-routing.node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ describe('.contentRouting', () => {
191191
// mock the swarm connect
192192
.post('/api/v0/swarm/connect')
193193
.query({
194-
arg: `/ip4/0.0.0.0/tcp/60194/p2p-circuit/ipfs/${nodeA.peerInfo.id.toB58String()}`,
194+
arg: `/ip4/0.0.0.0/tcp/60194/p2p-circuit/p2p/${nodeA.peerInfo.id.toB58String()}`,
195195
'stream-channels': true
196196
})
197197
.reply(200, {
@@ -222,7 +222,7 @@ describe('.contentRouting', () => {
222222
// mock the swarm connect
223223
.post('/api/v0/swarm/connect')
224224
.query({
225-
arg: `/ip4/0.0.0.0/tcp/60194/p2p-circuit/ipfs/${nodeA.peerInfo.id.toB58String()}`,
225+
arg: `/ip4/0.0.0.0/tcp/60194/p2p-circuit/p2p/${nodeA.peerInfo.id.toB58String()}`,
226226
'stream-channels': true
227227
})
228228
.reply(502, 'Bad Gateway', ['Content-Type', 'application/json'])

test/transports.browser.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const jsonPeerId = require('./fixtures/test-peer.json')
2121
describe('transports', () => {
2222
describe('websockets', () => {
2323
let peerB
24-
let peerBMultiaddr = '/ip4/127.0.0.1/tcp/9200/ws/ipfs/' + jsonPeerId.id
24+
let peerBMultiaddr = '/ip4/127.0.0.1/tcp/9200/p2p/' + jsonPeerId.id
2525
let nodeA
2626

2727
before((done) => {
@@ -256,11 +256,11 @@ describe('transports', () => {
256256
expect(err).to.not.exist()
257257

258258
peer1 = new PeerInfo(ids[0])
259-
const ma1 = '/ip4/127.0.0.1/tcp/15555/ws/p2p-webrtc-star/ipfs/' + ids[0].toB58String()
259+
const ma1 = '/ip4/127.0.0.1/tcp/15555/ws/p2p-webrtc-star/p2p/' + ids[0].toB58String()
260260
peer1.multiaddrs.add(ma1)
261261

262262
peer2 = new PeerInfo(ids[1])
263-
const ma2 = '/ip4/127.0.0.1/tcp/15555/ws/p2p-webrtc-star/ipfs/' + ids[1].toB58String()
263+
const ma2 = '/ip4/127.0.0.1/tcp/15555/ws/p2p-webrtc-star/p2p/' + ids[1].toB58String()
264264
peer2.multiaddrs.add(ma2)
265265

266266
done()
@@ -333,7 +333,7 @@ describe('transports', () => {
333333
}
334334

335335
const peer3 = new PeerInfo(id3)
336-
const ma3 = '/ip4/127.0.0.1/tcp/15555/ws/p2p-webrtc-star/ipfs/' + b58Id
336+
const ma3 = '/ip4/127.0.0.1/tcp/15555/ws/p2p-webrtc-star/p2p/' + b58Id
337337
peer3.multiaddrs.add(ma3)
338338

339339
node1.on('peer:discovery', (peerInfo) => node1.dial(peerInfo, check))
@@ -441,7 +441,7 @@ describe('transports', () => {
441441
expect(err).to.not.exist()
442442

443443
const peer3 = new PeerInfo(id3)
444-
const ma3 = '/ip4/127.0.0.1/tcp/14444/ws/p2p-websocket-star/ipfs/' + id3.toB58String()
444+
const ma3 = '/ip4/127.0.0.1/tcp/14444/ws/p2p-websocket-star/p2p/' + id3.toB58String()
445445
peer3.multiaddrs.add(ma3)
446446

447447
node1.on('peer:discovery', (peerInfo) => node1.dial(peerInfo, check))

test/turbolence.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('Turbolence tests', () => {
4848

4949
it('connect nodeA to that node', (done) => {
5050
const spawnedId = require('./test-data/test-id.json')
51-
const maddr = multiaddr('/ip4/127.0.0.1/tcp/12345/ipfs/' + spawnedId.id)
51+
const maddr = multiaddr('/ip4/127.0.0.1/tcp/12345/p2p/' + spawnedId.id)
5252

5353
nodeA.dial(maddr, '/echo/1.0.0', (err, conn) => {
5454
expect(err).to.not.exist()

0 commit comments

Comments
 (0)