feat: listen to array of multiaddrs (#104)

* feat: support listen on array

* chore: fix missing deps

* chore: update interface version

* docs: update readme for array listen

* test: use port 0

* docs: add some more jsdocs

* chore: fix travis support for ip6 on linux

* refactor: clean up some code
This commit is contained in:
Jacob Heun
2019-04-22 16:00:06 +02:00
parent b977a59fb8
commit d5be5ba7ed
6 changed files with 224 additions and 136 deletions

View File

@ -114,14 +114,14 @@ describe('listen', () => {
})
})
it('getAddrs preserves IPFS Id', (done) => {
it('getAddrs does not preserve IPFS Id', (done) => {
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const listener = tcp.createListener((conn) => {})
listener.listen(mh, () => {
listener.getAddrs((err, multiaddrs) => {
expect(err).to.not.exist()
expect(multiaddrs.length).to.equal(1)
expect(multiaddrs[0]).to.deep.equal(mh)
expect(multiaddrs[0]).to.deep.equal(mh.decapsulate('ipfs'))
listener.close(done)
})
})