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

hsd-net-logger

v0.0.2

Published

Log hsd node network message to peers.

Downloads

1

Readme

HSD Network Logger

Log network communication in "human readable" way.

This is intended for debug and education purposes only.
This is not meant for production use.

Options

Logger allows several options that can be passed from: args, env variables or hsd config files (same functionality as any other hsd config):

  • net-logger-dir - Where to store connection logs, it will create separate log file for each connection. default: /tmp/net-logger-XXXXXX
  • net-logger-time-id - Whether to include timestamp of the connection in the filename, default: false
  • net-logger-console - whether to output in console as well (can be spammy), default: false
  • net-logger-skip - which packet types to skip, default: empty

Running

Using NPM

  • install: npm i -g hsd-net-logger
  • Make sure global node_modules resolves hsd-net-logger
    • e.g. You could use export NODE_PATH=/usr/lib/node_modules (arch)
    • asdf example: export NODE_PATH="$NODE_PATH:\asdf where nodejs`/.npm/lib/node_modules"`
    • Basically, make sure node -e 'require("hsd-net-logger")' does not throw an error.
  • run: hsd --plugins hsd-net-logger

Using git or path

  • Clone: git clone https://github.com/nodech/hsd-net-logger
  • cd hsd-net-logger
  • hsd --plugins `pwd`

Example

Lets run the spv in memory:
$ hsd --memory --plugins hsd-net-logger --net-logger-dir=/tmp/hsd-packet-logs --net-logger-skip=ping,pong
After we stop you should see that /tmp/hsd-packet-logs folder has been created and may look like this:

.rw-r--r-- user group     0 B  Mon Aug  2 21:31:11 2021 peer-out--1-HOSTNAME1:12038-cleartext
.rw-r--r-- user group   217 B  Mon Aug  2 21:31:11 2021 peer-out--1-HOSTNAME2:12038-cleartext
.rw-r--r-- user group     0 B  Mon Aug  2 21:31:10 2021 peer-out--1-HOSTNAME3:12038-cleartext
.rw-r--r-- user group 240.7 KB Mon Aug  2 21:31:14 2021 peer-out--1-HOSTNAME4:12038-cleartext
...

And we can have a look at file that exchanged the data:

File: peer-out--1-HOSTNAME4-cleartext
==>> SEND, time: 2021-08-02T17:31:10Z(1627925470), payload size: 133 Bytes(133), type: VERSION,
  Protocol Version: 3
  Agent: /hsd:2.4.0/
  Services: NETWORK
  Height: 0
  Nonce: decba417013fafc2
  NoRelay: false
<<== RECV, time: 2021-08-02T17:31:10Z(1627925470), payload size: 0 Byte(-1), type: VERACK
<<== RECV, time: 2021-08-02T17:31:10Z(1627925470), payload size: 133 Bytes(133), type: VERSION,
  Protocol Version: 1
  Agent: /hsd:2.0.2/
  Services: NETWORK
  Height: 79089
  Nonce: 88bb42d022211766
  NoRelay: false
<<== RECV, time: 2021-08-02T17:31:10Z(1627925470), payload size: 89 Bytes(89), type: ADDR, Returned: 1 addresses
==>> SEND, time: 2021-08-02T17:31:10Z(1627925470), payload size: 0 Byte(-1), type: VERACK
==>> SEND, time: 2021-08-02T17:31:10Z(1627925470), payload size: 9 Bytes(9), type: SENDCMPCT,
  Compact mode: off
  Compact version: 1
==>> SEND, time: 2021-08-02T17:31:10Z(1627925470), payload size: 65 Bytes(65), type: GETHEADERS,
  Stop: 0000000000001013c28fa079b545fb805f04c496687799b98e35e83cbbb8953e
  Locator: ...66489760741d075992e0
<<== RECV, time: 2021-08-02T17:31:10Z(1627925470), payload size: 9 Bytes(9), type: SENDCMPCT,
  Compact mode: off
  Compact version: 1
<<== RECV, time: 2021-08-02T17:31:11Z(1627925471), payload size: 232.32 KiB(237891), type: HEADERS, Headers: 1008,
  ...9f5bacdb7433cd2f5971 ...6dda2217676f042ad0f2 ...83f385e9e359941ec704 ...73c265bd054e845e126e ... 1003 more items ... ...99b98e35e83cbbb8953e
==>> SEND, time: 2021-08-02T17:31:11Z(1627925471), payload size: 35.44 KiB(36291), type: GETDATA, with 1008 inv items,
  Compact blocks: 1008
    ...9f5bacdb7433cd2f5971 ...6dda2217676f042ad0f2 ...83f385e9e359941ec704 ...73c265bd054e845e126e ... 1003 more items ... ...99b98e35e83cbbb8953e
<<== RECV, time: 2021-08-02T17:31:12Z(1627925472), payload size: 351 Bytes(351), type: BLOCK,
  Block hash: 0000000000a5e40e8ba291bd7e8649747fa7fb8a7af39f5bacdb7433cd2f5971
  Version: 0
  Date: 2020-02-03T15:52:05Z(1580745125)
  ...