Expose libp2p connections through http-api
- Dominant language
- Go
- Stars
- 17.1k
- Forks
- 3.2k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 11
Description
In the js-ipfs land, some of the newer/more experimental [modules](https://github.com/ipfs-shipyard/ipfs-pubsub-room) have used libp2p's ability to do [custom protocol, direct connections](https://github.com/ipfs-shipyard/ipfs-pubsub-room/blob/master/src/connection.js#L51) with peers. This is a nice way of exchanging messages between peers and gives us some features out of the box (such as encrypted connections).
However, this functionality is not currently exposed through go-ipfs->http-api->js-ipfs-api which means modules using libp2p directly are not directly compatible with both the js-ipfs and go-ipfs implementations.
What we'd ideally want to do is to be able to write code like:
```javascript
this._ipfs._libp2pNode.dialProtocol(peerAddresses[0], PROTOCOL, (err, conn) => {...})
```
...in our applications and it would work seamlessly like it now does for most of ipfs. Effectively (correct me if I'm wrong) a connection stream between two peers through the http-api.
This was first brought up in https://github.com/ipfs-shipyard/ipfs-pubsub-room/issues/28 and I think @pgte @diasdavid and others might have input to this, too. I don't know what's involved on go-ipfs to make it happen, but at least js-ipfs-api will need work to expose it in JS. Perhaps we could do it similar to Pubsub streams.
Would ❤️to have this functionality :)
Contributor guide
Assessment
This issue has not been assessed yet.