2015-10-28 21:59:15 +00:00
2015-07-23 14:05:43 -07:00
2015-08-25 11:00:19 +01:00
2015-07-23 14:05:43 -07:00
2015-10-28 21:59:15 +00:00
2015-10-28 21:59:15 +00:00

js-libp2p

[ Build Status](https://travis-ci.org/diasdavid/js-libp2p) Dependency Status js-standard-style

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.

libp2p becomes very simple and basically acts as a glue for every module that compose this library. Since it can be highly customized, it requires some setup. What we recommend is to have a libp2p build for the system you are developing taking into account in your needs (e.g. for a browser working version of libp2p that acts as the network layer of IPFS, we have a built and minified version that browsers can require)

Setting everything up

var Libp2p = require('libp2p')

// set up a Swarm, Peer Routing and Record Store instances, the last two are optional

var p2p = new Libp2p(swarm, [peerRouting, recordStore])

Dialing and listening

p2p.swarm.dial(peerInfo, options, protocol, function (err, stream) {}) p2p.swarm.handleProtocol(protocol, options, handlerFunction)

Using Peer Routing

p2p.routing.findPeers(key, function (err, peerInfos) {})

Using Records

p2p.record.get(key, function (err, records) {}) p2p.record.store(key, record)

Stats

Notes

Img for ref (till we get a better graph)

Description
No description provided
Readme 23 MiB
Languages
TypeScript 100%