npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

libp2p-pstn

v0.0.3

Published

Benchmark utility for designing and testing new js-libp2p pubsub strategies

Downloads

21

Readme

libp2p pstn

The Libp2p Pubsub Testnet (libp2p-pstn) is a utility for initializing arbitrary networks of libp2p nodes connected by some topology. It provides useful benchmarking tools for designing and implementing p2p pubsub/messaging strategies and is composed of modules from the libp2p-pstn-* ecosystem.

Install

To install through npm:

> npm i libp2p-pstn --save

Example

Run the UI client with the default topology (ring) and default/example pubsub events:

> npm start

Go to http://localhost:8080 in your browser. Open the console for logs, or just click the "Start Testnet Runner" button to kick off the pubsub test. Events will stream in followed by propagation stats and the full event log.

If you want to swap the topology (with a mesh or your own function) or rework the script for which nodes subscribe to what and who send what, open the runner.js file in the root and customize the run function. It should be pretty straightforward.

For a real example check out example.js, otherwise take a look below.

Note about client page refreshes: If you refresh the page, you need to restart the server. This will be fixed soon.

API

Testnet

new Testnet({ size: <int>, pubsub: <pubsub_strategy> })

Instance Properties

instance.size

instance.nodes

Nodes in the the network are structured as follows:

{
  peerInfo: <peer_info_instance>,
  libp2p: <libp2p_nstance>,
  id: <peer_info_id_b58>,
  pubsub: <pubsub_node_instance>
}

instance.stats

Returns a js-libp2p-pstn-stats instance built from pubsub node activity event logs.

Demo

To run the UI client:

> npm start

Tests

To run the tests:

> npm test

Ecosystem

libp2p-pstn is composed of a small, developing ecosystem for testing p2p messaging strategies in libp2p. They follow the libp2p-pstn-* convention.

Logging

  • libp2p-pstn-logger: Decorates a pubsub node instance and logs under the pstn:logger namespace in a format consumable by a stats parser (repo). Currently built to work with floodsub.

Statistics

  • libp2p-pstn-stats: Generates in basic stats for a testnet instance based on logs from all pubsub node activity (repo).

Topologies

  • libp2p-pstn-topo-*: Topologies used to connect a testnet instance.

  • libp2p-pstn-topo-ring: Ring topology (repo).

  • libp2p-pstn-topo-partialmesh: Partial mesh topology with 2 connections per peer (repo).

Contribute

PRs are welcome!

License

MIT © Gavin McDermott