0.0.3 • Published 8 years ago

libp2p-pstn-topo-ring v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

js libp2p pstn topo ring

A ring topology for use in libp2p pubsub testing.

Install

To install through npm:

> npm i libp2p-pstn-topo-ring --save

Example

libp2p-pstn-topo-ring works as a topology for the js-libp2p pubsub testnet. It fits into the libp2p-pstn-topo-* ecosystem.

const createRing = require('libp2p-pstn-topo-ring')

// Note: nodes must adhere to this interface:
// { peerInfo: <peerInfo>, libp2p: <libp2p> }
const nodes = [nodeA, nodeB, ..., nodeN]

createRing(nodes).then((connectedNodes) => {
  // your nodes are now connected in a ring topology
})

API

createRing(<nodes>)

This API returns a promise with an array of the connected nodes.

Tests

To run the basic tests:

> npm test

Contribute

PRs are welcome!

License

MIT © Gavin McDermott