Richard Littauer 3c93b7cd4e Standardized Readme
Thoughts?
2016-09-02 15:22:28 -04:00
2016-03-23 15:30:14 +01:00
2016-03-23 15:30:14 +01:00
2016-03-23 15:30:14 +01:00
2016-03-23 15:30:14 +01:00
2016-03-23 15:30:14 +01:00
2015-07-23 14:05:43 -07:00
2016-04-07 21:20:56 +02:00
2016-09-02 15:22:28 -04:00

js-libp2p

[ Build Status coverage Dependency Status js-standard-style

JavaScript implementation of libp2p

libp2p is a networking stack and library modularized out of The IPFS Project, and bundled separately for other tools to use.

Table of Contents

Background

libp2p is the product of a long, and arduous quest of understanding -- a deep dive into the internet's network stack, and plentiful peer-to-peer protocols from the past. Building large scale peer-to-peer systems has been complex and difficult in the last 15 years, and libp2p is a way to fix that. It is a "network stack" -- a protocol suite -- that cleanly separates concerns, and enables sophisticated applications to only use the protocols they absolutely need, without giving up interoperability and upgradeability. libp2p grew out of IPFS, but it is built so that lots of people can use it, for lots of different projects.

We will be writing a set of docs, posts, tutorials, and talks to explain what p2p is, why it is tremendously useful, and how it can help your existing and new projects.

Packages

Package Version Dependencies DevDependencies
peer-book npm Dependency Status devDependency Status
libp2p-ipfs npm Dependency Status devDependency Status
libp2p-ipfs-browser npm Dependency Status devDependency Status
libp2p-secio npm Dependency Status devDependency Status
libp2p-swarm npm Dependency Status devDependency Status
libp2p-ping npm Dependency Status devDependency Status
interface-connection npm Dependency Status devDependency Status
libp2p-utp npm Dependency Status devDependency Status
interface-stream-muxer npm Dependency Status devDependency Status
libp2p-spdy npm Dependency Status devDependency Status
libp2p-kad-routing npm Dependency Status devDependency Status
libp2p-mdns-discovery npm Dependency Status devDependency Status
libp2p-railing npm Dependency Status devDependency Status
libp2p-record npm Dependency Status devDependency Status
interface-record-store npm Dependency Status devDependency Status
libp2p-distributed-record-store npm Dependency Status devDependency Status
libp2p-kad-record-store npm Dependency Status devDependency Status
libp2p-websockets npm Dependency Status devDependency Status
libp2p-webrtc-star npm Dependency Status devDependency Status
multistream-select npm Dependency Status devDependency Status

Notes

Img for ref (till we get a better graph)

Install

npm i --save libp2p

Usage

This is a work in progress. The 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

TODO

Contribute

THe libp2p implementation in JavaScript is a work in progress. As such, there's a few things you can do right now to help out:

  • Go through the modules below and check out existing issues. This would be especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrasture behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
  • Perform code reviews. Most of this has been developed by @diasdavid, which means that more eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
  • Add tests. There can never be enough tests.

License

MIT © David Dias

Description
No description provided
Readme 23 MiB
Languages
TypeScript 100%