Compare commits

..

No commits in common. "master" and "v0.14.3" have entirely different histories.

12 changed files with 82 additions and 211 deletions

View File

@ -27,6 +27,7 @@ jobs:
- stage: check
os: linux
script:
- npx aegir build --bundlesize
- npx aegir dep-check
- npm run lint

View File

@ -1,93 +1,3 @@
<a name="0.15.3"></a>
## [0.15.3](https://github.com/libp2p/js-libp2p-tcp/compare/v0.15.2...v0.15.3) (2021-02-03)
### Bug Fixes
* hanging close promise ([#140](https://github.com/libp2p/js-libp2p-tcp/issues/140)) ([3813100](https://github.com/libp2p/js-libp2p-tcp/commit/3813100))
<a name="0.15.2"></a>
## [0.15.2](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.2...v0.15.2) (2020-12-28)
### Bug Fixes
* catch error from maConn.close ([#128](https://github.com/libp2p/js-libp2p-tcp/issues/128)) ([0fe0815](https://github.com/libp2p/js-libp2p-tcp/commit/0fe0815))
* catch thrown maConn errors in listener ([#122](https://github.com/libp2p/js-libp2p-tcp/issues/122)) ([86db568](https://github.com/libp2p/js-libp2p-tcp/commit/86db568)), closes [#121](https://github.com/libp2p/js-libp2p-tcp/issues/121)
* intermittent error when asking for interfaces ([#137](https://github.com/libp2p/js-libp2p-tcp/issues/137)) ([af9804e](https://github.com/libp2p/js-libp2p-tcp/commit/af9804e))
* remove use of assert module ([#123](https://github.com/libp2p/js-libp2p-tcp/issues/123)) ([6272876](https://github.com/libp2p/js-libp2p-tcp/commit/6272876))
* transport should not handle connection if upgradeInbound throws ([#119](https://github.com/libp2p/js-libp2p-tcp/issues/119)) ([21f8747](https://github.com/libp2p/js-libp2p-tcp/commit/21f8747))
### Chores
* update deps ([#134](https://github.com/libp2p/js-libp2p-tcp/issues/134)) ([d9f9912](https://github.com/libp2p/js-libp2p-tcp/commit/d9f9912))
### BREAKING CHANGES
* - The multiaddr dep used by this module returns Uint8Arrays and may
not be compatible with previous versions
* chore: update utils
* chore: remove gh dep url
<a name="0.15.1"></a>
## [0.15.1](https://github.com/libp2p/js-libp2p-tcp/compare/v0.15.0...v0.15.1) (2020-08-11)
<a name="0.15.0"></a>
# [0.15.0](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.6...v0.15.0) (2020-08-07)
### Chores
* update deps ([#134](https://github.com/libp2p/js-libp2p-tcp/issues/134)) ([d9f9912](https://github.com/libp2p/js-libp2p-tcp/commit/d9f9912))
### BREAKING CHANGES
* - The multiaddr dep used by this module returns Uint8Arrays and may
not be compatible with previous versions
* chore: update utils
* chore: remove gh dep url
<a name="0.14.6"></a>
## [0.14.6](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.5...v0.14.6) (2020-07-17)
<a name="0.14.5"></a>
## [0.14.5](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.4...v0.14.5) (2020-04-28)
### Bug Fixes
* catch error from maConn.close ([#128](https://github.com/libp2p/js-libp2p-tcp/issues/128)) ([0fe0815](https://github.com/libp2p/js-libp2p-tcp/commit/0fe0815))
<a name="0.14.4"></a>
## [0.14.4](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.3...v0.14.4) (2020-02-24)
### Bug Fixes
* catch thrown maConn errors in listener ([#122](https://github.com/libp2p/js-libp2p-tcp/issues/122)) ([86db568](https://github.com/libp2p/js-libp2p-tcp/commit/86db568)), closes [#121](https://github.com/libp2p/js-libp2p-tcp/issues/121)
* remove use of assert module ([#123](https://github.com/libp2p/js-libp2p-tcp/issues/123)) ([6272876](https://github.com/libp2p/js-libp2p-tcp/commit/6272876))
<a name="0.14.3"></a>
## [0.14.3](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.2...v0.14.3) (2019-12-20)

View File

@ -9,11 +9,11 @@
[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-tcp.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-tcp)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
[![](https://raw.githubusercontent.com/libp2p/js-libp2p-interfaces/master/src/transport/img/badge.png)](https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/transport)
[![](https://raw.githubusercontent.com/libp2p/js-libp2p-interfaces/master/src/connection/img/badge.png)](https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/connection)
[![](https://raw.githubusercontent.com/libp2p/interface-transport/master/img/badge.png)](https://github.com/libp2p/interface-transport)
[![](https://raw.githubusercontent.com/libp2p/interface-connection/master/img/badge.png)](https://github.com/libp2p/interface-connection)
> JavaScript implementation of the TCP module for libp2p. It exposes the [interface-transport](https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/transport) for dial/listen. `libp2p-tcp` is a very thin shim that adds support for dialing to a `multiaddr`. This small shim will enable libp2p to use other transports.
> JavaScript implementation of the TCP module for libp2p. It exposes the [interface-transport](https://github.com/libp2p/interface-connection) for dial/listen. `libp2p-tcp` is a very thin shim that adds support for dialing to a `multiaddr`. This small shim will enable libp2p to use other transports.
## Lead Maintainer
@ -87,7 +87,7 @@ Value: hello
### Transport
[![](https://raw.githubusercontent.com/libp2p/js-libp2p-interfaces/master/src/transport/img/badge.png)](https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/transport)
[![](https://raw.githubusercontent.com/libp2p/interface-transport/master/img/badge.png)](https://github.com/libp2p/interface-transport)
`libp2p-tcp` accepts TCP addresses as both IPFS and non IPFS encapsulated addresses, i.e:
@ -98,8 +98,7 @@ Value: hello
### Connection
[![](https://raw.githubusercontent.com/libp2p/js-libp2p-interfaces/master/src/connection/img/badge.png)](https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/connection)
[![](https://raw.githubusercontent.com/libp2p/interface-connection/master/img/badge.png)](https://github.com/libp2p/interface-connection)
## Contribute

View File

@ -1,6 +1,6 @@
{
"name": "libp2p-tcp",
"version": "0.15.3",
"version": "0.14.3",
"description": "Node.js implementation of the TCP module that libp2p uses, which implements the interface-connection and interface-transport interfaces",
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
"main": "src/index.js",
@ -33,41 +33,43 @@
"npm": ">=3.0.0"
},
"devDependencies": {
"aegir": "^25.0.0",
"aegir": "^20.4.1",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1",
"libp2p-interfaces": "^0.2.0",
"it-pipe": "^1.1.0",
"libp2p-interfaces": "fluencelabs/js-libp2p-interfaces",
"sinon": "^9.0.0",
"streaming-iterables": "^5.0.2"
"sinon": "^7.5.0",
"streaming-iterables": "^4.1.1"
},
"dependencies": {
"abortable-iterator": "^3.0.0",
"class-is": "^1.1.0",
"debug": "^4.1.1",
"err-code": "^2.0.0",
"libp2p-utils": "fluencelabs/js-libp2p-utils",
"mafmt": "fluencelabs/js-mafmt",
"multiaddr": "^9.0.1",
"stream-to-it": "^0.2.2"
"libp2p-utils": "~0.1.0",
"mafmt": "^7.0.0",
"multiaddr": "^7.2.1",
"stream-to-it": "^0.2.0"
},
"contributors": [
"David Dias <daviddias.p@gmail.com>",
"Jacob Heun <jacobheun@gmail.com>",
"Stephen Whitmore <stephen.whitmore@gmail.com>",
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"Vasco Santos <vasco.santos@moxy.studio>",
"Alex Potsides <alex@achingbrain.net>",
"Richard Littauer <richard.littauer@gmail.com>",
"Tom White <tomtinkerer@gmail.com>",
"Alan Shaw <alan.shaw@protocol.ai>",
"Alan Shaw <alan@tableflip.io>",
"Pedro Teixeira <i@pgte.me>",
"Prashanth Chandra <coolshanth94@gmail.com>",
"João Antunes <j.goncalo.antunes@gmail.com>",
"Cayman <caymannava@gmail.com>",
"David Dias <daviddias.p@gmail.com>",
"Diogo Silva <fsdiogo@gmail.com>",
"Dmitriy Ryajov <dryajov@gmail.com>",
"Drew Stone <drewstone329@gmail.com>",
"Evan Schwartz <evan.mark.schwartz@gmail.com>",
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"Greenkeeper <support@greenkeeper.io>",
"Jacob Heun <jacobheun@gmail.com>",
"Jacob Heun <jake@andyet.net>",
"João Antunes <j.goncalo.antunes@gmail.com>",
"Linus Unnebäck <linus@folkdatorn.se>",
"Mikeal Rogers <mikeal.rogers@gmail.com>"
"Pedro Teixeira <i@pgte.me>",
"Prashanth Chandra <coolshanth94@gmail.com>",
"Richard Littauer <richard.littauer@gmail.com>",
"Stephen Whitmore <stephen.whitmore@gmail.com>",
"TomCoded <tomtinkerer@gmail.com>",
"Vasco Santos <vasco.santos@moxy.studio>"
]
}

View File

@ -10,6 +10,7 @@ const createListener = require('./listener')
const { multiaddrToNetConfig } = require('./utils')
const { AbortError } = require('abortable-iterator')
const { CODE_CIRCUIT, CODE_P2P } = require('./constants')
const assert = require('assert')
/**
* @class TCP
@ -21,9 +22,7 @@ class TCP {
* @param {Upgrader} options.upgrader
*/
constructor ({ upgrader }) {
if (!upgrader) {
throw new Error('An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.')
}
assert(upgrader, 'An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.')
this._upgrader = upgrader
}

View File

@ -13,19 +13,6 @@ const {
multiaddrToNetConfig
} = require('./utils')
/**
* Attempts to close the given maConn. If a failure occurs, it will be logged.
* @private
* @param {MultiaddrConnection} maConn
*/
async function attemptClose (maConn) {
try {
maConn && await maConn.close()
} catch (err) {
log.error('an error occurred closing the connection', err)
}
}
module.exports = ({ handler, upgrader }, options) => {
const listener = new EventEmitter()
@ -33,15 +20,15 @@ module.exports = ({ handler, upgrader }, options) => {
// Avoid uncaught errors caused by unstable connections
socket.on('error', err => log('socket error', err))
let maConn
const maConn = toConnection(socket, { listeningAddr })
log('new inbound connection %s', maConn.remoteAddr)
let conn
try {
maConn = toConnection(socket, { listeningAddr })
log('new inbound connection %s', maConn.remoteAddr)
conn = await upgrader.upgradeInbound(maConn)
} catch (err) {
log.error('inbound connection failed', err)
return attemptClose(maConn)
log.error('inbound connection failed to upgrade', err)
return maConn.close()
}
log('inbound connection %s upgraded', maConn.remoteAddr)
@ -64,7 +51,7 @@ module.exports = ({ handler, upgrader }, options) => {
if (!server.listening) return
return new Promise((resolve, reject) => {
server.__connections.forEach(maConn => attemptClose(maConn))
server.__connections.forEach(maConn => maConn.close())
server.close(err => err ? reject(err) : resolve())
})
}

View File

@ -78,10 +78,7 @@ module.exports = (socket, options) => {
resolve()
}, CLOSE_TIMEOUT)
socket.once('close', () => {
clearTimeout(timeout)
resolve()
})
socket.once('close', () => clearTimeout(timeout))
socket.end(err => {
maConn.timeline.close = Date.now()
if (err) return reject(err)

View File

@ -16,7 +16,7 @@ function multiaddrToNetConfig (addr) {
}
function getMultiaddrs (proto, ip, port) {
const toMa = ip => new multiaddr.Multiaddr(`/${proto}/${ip}/tcp/${port}`)
const toMa = ip => multiaddr(`/${proto}/${ip}/tcp/${port}`)
return (isAnyAddr(ip) ? getNetworkAddrs(ProtoFamily[proto]) : [ip]).map(toMa)
}
@ -29,9 +29,8 @@ function isAnyAddr (ip) {
* @param {string} family One of ['IPv6', 'IPv4']
* @returns {string[]} an array of ip address strings
*/
const networks = os.networkInterfaces()
function getNetworkAddrs (family) {
return Object.values(networks).reduce((addresses, netAddrs) => {
return Object.values(os.networkInterfaces()).reduce((addresses, netAddrs) => {
netAddrs.forEach(netAddr => {
// Add the ip of each matching network interface
if (netAddr.family === family) addresses.push(netAddr.address)

View File

@ -12,9 +12,9 @@ describe('interface-transport compliance', () => {
setup ({ upgrader }) {
const tcp = new TCP({ upgrader })
const addrs = [
new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9091'),
new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9092'),
new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9093')
multiaddr('/ip4/127.0.0.1/tcp/9091'),
multiaddr('/ip4/127.0.0.1/tcp/9092'),
multiaddr('/ip4/127.0.0.1/tcp/9093')
]
// Used by the dial tests to simulate a delayed connect

View File

@ -1,7 +1,10 @@
/* eslint-env mocha */
'use strict'
const { expect } = require('aegir/utils/chai')
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const TCP = require('../src')
const multiaddr = require('multiaddr')
@ -17,7 +20,7 @@ describe('valid localAddr and remoteAddr', () => {
tcp = new TCP({ upgrader: mockUpgrader })
})
const ma = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/0')
const ma = multiaddr('/ip4/127.0.0.1/tcp/0')
it('should resolve port 0', async () => {
// Create a Promise that resolves when a connection is handled
@ -50,36 +53,4 @@ describe('valid localAddr and remoteAddr', () => {
expect(dialerConn.remoteAddr.toString())
.to.equal(listenerConn.localAddr.toString())
})
it('should handle multiple simultaneous closes', async () => {
// Create a Promise that resolves when a connection is handled
let handled
const handlerPromise = new Promise(resolve => { handled = resolve })
const handler = conn => handled(conn)
// Create a listener with the handler
const listener = tcp.createListener(handler)
// Listen on the multi-address
await listener.listen(ma)
const localAddrs = listener.getAddrs()
expect(localAddrs.length).to.equal(1)
// Dial to that address
const dialerConn = await tcp.dial(localAddrs[0])
// Wait for the incoming dial to be handled
await handlerPromise
// Close the listener with two simultaneous calls to `close`
await Promise.race([
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Timed out waiting for connection close')), 500)),
await Promise.all([
dialerConn.close(),
dialerConn.close()
])
])
})
})

View File

@ -1,7 +1,10 @@
/* eslint-env mocha */
'use strict'
const { expect } = require('aegir/utils/chai')
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const TCP = require('../src')
const multiaddr = require('multiaddr')
@ -16,14 +19,14 @@ describe('filter addrs', () => {
})
it('filter valid addrs for this transport', () => {
const ma1 = new multiaddr.Multiaddr(base + '/tcp/9090')
const ma2 = new multiaddr.Multiaddr(base + '/udp/9090')
const ma3 = new multiaddr.Multiaddr(base + '/tcp/9090/http')
const ma4 = new multiaddr.Multiaddr(base + '/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const ma5 = new multiaddr.Multiaddr(base + '/tcp/9090/http' + ipfs)
const ma6 = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090/p2p-circuit' + ipfs)
const ma7 = new multiaddr.Multiaddr('/dns4/libp2p.io/tcp/9090')
const ma8 = new multiaddr.Multiaddr('/dnsaddr/libp2p.io/tcp/9090')
const ma1 = multiaddr(base + '/tcp/9090')
const ma2 = multiaddr(base + '/udp/9090')
const ma3 = multiaddr(base + '/tcp/9090/http')
const ma4 = multiaddr(base + '/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const ma5 = multiaddr(base + '/tcp/9090/http' + ipfs)
const ma6 = multiaddr('/ip4/127.0.0.1/tcp/9090/p2p-circuit' + ipfs)
const ma7 = multiaddr('/dns4/libp2p.io/tcp/9090')
const ma8 = multiaddr('/dnsaddr/libp2p.io/tcp/9090')
const valid = tcp.filter([ma1, ma2, ma3, ma4, ma5, ma6, ma7, ma8])
expect(valid.length).to.equal(4)
@ -32,7 +35,7 @@ describe('filter addrs', () => {
})
it('filter a single addr for this transport', () => {
const ma1 = new multiaddr.Multiaddr(base + '/tcp/9090')
const ma1 = multiaddr(base + '/tcp/9090')
const valid = tcp.filter(ma1)
expect(valid.length).to.equal(1)

View File

@ -1,7 +1,10 @@
/* eslint-env mocha */
'use strict'
const { expect } = require('aegir/utils/chai')
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const TCP = require('../src')
const net = require('net')
const os = require('os')
@ -37,7 +40,7 @@ describe('listen', () => {
})
it('close listener with connections, through timeout', async () => {
const mh = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
listener = tcp.createListener((conn) => {
pipe(conn, conn)
})
@ -62,14 +65,14 @@ describe('listen', () => {
// Windows doesn't support unix paths
skipOnWindows('listen on path', async () => {
const mh = new multiaddr.Multiaddr(`/unix${path.resolve(os.tmpdir(), '/tmp/p2pd.sock')}`)
const mh = multiaddr(`/unix${path.resolve(os.tmpdir(), '/tmp/p2pd.sock')}`)
listener = tcp.createListener((conn) => {})
await listener.listen(mh)
})
it('listen on port 0', async () => {
const mh = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/0')
const mh = multiaddr('/ip4/127.0.0.1/tcp/0')
listener = tcp.createListener((conn) => {})
await listener.listen(mh)
})
@ -78,19 +81,19 @@ describe('listen', () => {
if (isCI) {
return
}
const mh = new multiaddr.Multiaddr('/ip6/::/tcp/9090')
const mh = multiaddr('/ip6/::/tcp/9090')
listener = tcp.createListener((conn) => {})
await listener.listen(mh)
})
it('listen on any Interface', async () => {
const mh = new multiaddr.Multiaddr('/ip4/0.0.0.0/tcp/9090')
const mh = multiaddr('/ip4/0.0.0.0/tcp/9090')
listener = tcp.createListener((conn) => {})
await listener.listen(mh)
})
it('getAddrs', async () => {
const mh = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090')
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090')
listener = tcp.createListener((conn) => {})
await listener.listen(mh)
@ -100,7 +103,7 @@ describe('listen', () => {
})
it('getAddrs on port 0 listen', async () => {
const mh = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/0')
const mh = multiaddr('/ip4/127.0.0.1/tcp/0')
listener = tcp.createListener((conn) => {})
await listener.listen(mh)
@ -109,7 +112,7 @@ describe('listen', () => {
})
it('getAddrs from listening on 0.0.0.0', async () => {
const mh = new multiaddr.Multiaddr('/ip4/0.0.0.0/tcp/9090')
const mh = multiaddr('/ip4/0.0.0.0/tcp/9090')
listener = tcp.createListener((conn) => {})
await listener.listen(mh)
@ -119,7 +122,7 @@ describe('listen', () => {
})
it('getAddrs from listening on 0.0.0.0 and port 0', async () => {
const mh = new multiaddr.Multiaddr('/ip4/0.0.0.0/tcp/0')
const mh = multiaddr('/ip4/0.0.0.0/tcp/0')
listener = tcp.createListener((conn) => {})
await listener.listen(mh)
@ -129,7 +132,7 @@ describe('listen', () => {
})
it('getAddrs preserves IPFS Id', async () => {
const mh = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
listener = tcp.createListener((conn) => {})
await listener.listen(mh)
@ -142,7 +145,7 @@ describe('listen', () => {
describe('dial', () => {
let tcp
let listener
const ma = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090')
const ma = multiaddr('/ip4/127.0.0.1/tcp/9090')
beforeEach(async () => {
tcp = new TCP({
@ -177,7 +180,7 @@ describe('dial', () => {
return
}
const ma = new multiaddr.Multiaddr('/ip6/::/tcp/9066')
const ma = multiaddr('/ip6/::/tcp/9066')
const listener = tcp.createListener((conn) => {
pipe(conn, conn)
})
@ -195,7 +198,7 @@ describe('dial', () => {
// Windows doesn't support unix paths
skipOnWindows('dial on path', async () => {
const ma = new multiaddr.Multiaddr(`/unix${path.resolve(os.tmpdir(), '/tmp/p2pd.sock')}`)
const ma = multiaddr(`/unix${path.resolve(os.tmpdir(), '/tmp/p2pd.sock')}`)
const listener = tcp.createListener((conn) => {
pipe(conn, conn)
@ -220,7 +223,7 @@ describe('dial', () => {
handled = resolve
})
const ma = new multiaddr.Multiaddr('/ip6/::/tcp/0')
const ma = multiaddr('/ip6/::/tcp/0')
const listener = tcp.createListener(async (conn) => {
await pipe(
@ -248,7 +251,7 @@ describe('dial', () => {
handled = resolve
})
const ma = new multiaddr.Multiaddr('/ip6/::/tcp/0')
const ma = multiaddr('/ip6/::/tcp/0')
const listener = tcp.createListener(async (conn) => {
// pull(conn, pull.onEnd(destroyed))
@ -265,7 +268,7 @@ describe('dial', () => {
})
it('dial on IPv4 with IPFS Id', async () => {
const ma = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const ma = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const conn = await tcp.dial(ma)
const res = await pipe(