Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

WIP - Feat/circuit interop #81

Merged
merged 3 commits into from
Oct 13, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const net = require('net')
const toPull = require('stream-to-pull-stream')
const mafmt = require('mafmt')
const includes = require('lodash.includes')
const isFunction = require('lodash.isfunction')
const Connection = require('interface-connection').Connection
const once = require('once')
Expand Down Expand Up @@ -68,9 +67,6 @@ class TCP {
multiaddrs = [multiaddrs]
}
return multiaddrs.filter((ma) => {
if (includes(ma.protoNames(), 'ipfs')) {
ma = ma.decapsulate('ipfs')
}
return mafmt.TCP.matches(ma)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes from the call today:

It should continue to be valid to pass an ipfs multiaddr, it just needs to check things differently.

    1. check if it is relay, if it is, skip it
    1. if not relay, check if it is ipfs, if it is, decapsulate
    1. check if it is TCP, if it is, include it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diasdavid ii and iii already happen in master, so it should be adding a check for circuit and skipping it if its present (i).

})
}
Expand Down
3 changes: 2 additions & 1 deletion test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,9 @@ describe('filter addrs', () => {
const mh2 = multiaddr('/ip4/127.0.0.1/udp/9090')
const mh3 = multiaddr('/ip4/127.0.0.1/tcp/9090/http')
const mh4 = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const mh5 = multiaddr('/ip4/127.0.0.1/tcp/9090/http/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')

const valid = tcp.filter([mh1, mh2, mh3, mh4])
const valid = tcp.filter([mh1, mh2, mh3, mh4, mh5])
expect(valid.length).to.equal(2)
expect(valid[0]).to.deep.equal(mh1)
expect(valid[1]).to.deep.equal(mh4)
Expand Down