mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-03-16 07:30:51 +00:00
1.7 KiB
1.7 KiB
node-libp2p
[
](https://travis-ci.org/diasdavid/node-libp2p)
Node.js implementation of libp2p
Interface
This is a work in progress, interface might change at anytime
libp2p expects a Record Store interface, a swarm and one or more Peer Routers that implement the Peer Routing, the goal is to keep simplicity and plugability while the remaining modules execute the heavy lifting.
Setting everything up
var libp2p = require('libp2p')
Dialing and listening
libp2p.swarm.dialStream(peerInfo, protocol, options, function (err, stream) {}) libp2p.swarm.handleProtocol(protocol, options, handlerFunction)
Using Peer Routing
libp2p.routing.findPeers(key, function (err, peerInfos) {})
Using Records
libp2p.record.get(key, function (err, records) {}) libp2p.record.store(key, record)
Stats
Notes
Img for ref (till we get a better graph)