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

@ndn/cli-common

v0.0.20240630

Published

NDNts: common routines for CLI programs

Downloads

21

Readme

@ndn/cli-common

This package is part of NDNts, Named Data Networking libraries for the modern web.

This package implements common routines for NDNts based CLI programs. In particular, it initializes KeyChain and uplink faces. These can be configured via environment variables. Moreover, environment variables in .env file will be loaded automatically.

KeyChain Configuration

NDNTS_KEYCHAIN environment variable specifies the KeyChain locator, which is a filesystem path where KeyChain files are stored. If empty, a temporary in-memory KeyChain will be used.

NDNTS_KEY environment variable specifies the default signing key. It's recommended to use a certificate name, but this can also be a key name or prefix of a subject name. If empty, any key in the KeyChain may be used. If the specified prefix does not match any existing key, digest signing will be used.

Logical Forwarder and Uplink Configuration

NDNTS_PKTTRACE=1 environment variable enables logical forwarder tracing.

NDNTS_UPLINK environment variable creates an uplink to another forwarder/node. It supports:

  • connect to NFD (or similar) via Unix socket, e.g. unix:///run/nfd/nfd.sock
    • This scheme accepts fallback parameters for alternative Unix socket paths. If the primary socket does not exist but a fallback exists, it would be used instead.
  • connect to NFD via TCP, e.g. tcp://192.0.2.1:6363
  • connect to NFD via UDP unicast, e.g. udp://192.0.2.1:6363
  • connect to NDN-DPDK via UDP: ndndpdk: or ndndpdk-udp:
    • See NDNTS_NDNDPDK_* environment variables described below.
  • connect to NDN-DPDK via memif: ndndpdk-memif:
    • See NDNTS_NDNDPDK_* environment variables described below.
  • perform NDN-FCH query and connect to global NDN network: autoconfig: (prefer UDP) or autoconfig-tcp: (prefer TCP)

The default is platform-dependent:

  • Linux: unix:///run/nfd/nfd.sock with fallback /run/nfd.sock and /run/ndn/nfd.sock
  • Windows: tcp://127.0.0.1:6363
  • other platforms: unix:///var/run/nfd/nfd.sock with fallback /var/run/nfd.sock

NDNTS_MTU environment variable sets the MTU for fragmentation of outgoing packets, applicable to UDP and memif. It must be a positive integer, and the default value is 1400. It's recommended to increase this value when using memif.

NDNTS_NFDREG=0 environment variable disables prefix registration on the uplink using NFD management protocol. The default is enabling NFD prefix registration if the uplink is possibly connected to NFD.

NDNTS_NFDREGKEY environment variable specifies the signing key for prefix registration commands. This accepts the same syntax as NDNTS_KEY. The default is using the same key as NDNTS_KEY.

NDNTS_NDNDPDK_GQLSERVER environment variable specifies the NDN-DPDK GraphQL server endpoint. The default is http://127.0.0.1:3030. This is only used when NDNTS_UPLINK specifies an uplink in NDN-DPDK.

NDNTS_NDNDPDK_LOCAL environment variable specifies a local IP address that is reachable from NDN-DPDK. The default is auto-detected from GraphQL HTTP client.

NDNTS_NDNDPDK_MEMIF_SOCKETPATH environment variable specifies a directory for memif control socket. The default is /run/ndn. If NDN-DPDK is running in a container, this directory must be mounted into the NDN-DPDK container.

API

exitClosers array allows scheduling objects to be closed at exit. exitHandler function is registered as SIGINT handle that is triggered upon pressing CTRL+C, which closes the objects in exitClosers. You may disable this handler with process.off("SIGINT", exitHandler).

openKeyChain function returns the specified KeyChain. getSigner function returns a signer using the default signing key.

openUplinks function creates the uplink. It also enables prefix registration unless explicitly disabled.

closeUplinks function closes the uplink. Uplinks are also automatically closed at exit via exitClosers.