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

tcpie

v11.0.0

Published

Ping any TCP port

Downloads

380

Readme

tcpie

Ping any TCP port

tcpie is a tool to measure latency and verify the reliabilty of a TCP connection. It does so by initiating a handshake followed by an immediately termination of the socket. While many existing tools require raw socket access, tcpie runs fine in user space. An API for use as a module is also provided.

CLI

Installation

$ npm i -g tcpie

Example

$ tcpie -c 5 google.com 443
TCPIE google.com (188.21.9.120) port 443
connected to google.com:443 seq=1 srcport=59053 time=12.9 ms
connected to google.com:443 seq=2 srcport=59054 time=10.0 ms
connected to google.com:443 seq=3 srcport=59055 time=10.1 ms
connected to google.com:443 seq=4 srcport=59056 time=11.4 ms
connected to google.com:443 seq=5 srcport=59057 time=10.4 ms

--- google.com tcpie statistics ---
5 handshakes attempted, 5 succeeded, 0% failed
rtt min/avg/max/stdev = 10.012/10.970/12.854/1.190 ms

API

Usage

import {tcpie} from "tcpie";
const pie = tcpie("google.com", 443, {count: 10, interval: 500, timeout: 2000});

pie.on("connect", function(stats) {
  console.info("connect", stats);
}).on("error", function(err, stats) {
  console.error(err, stats);
}).on("timeout", function(stats) {
  console.info("timeout", stats);
}).on("end", function(stats) {
  console.info(stats);
  // -> {
  // ->   sent: 10,
  // ->   success: 10,
  // ->   failed: 0,
  // ->   target: { host: "google.com", port: 443 }
  // -> }
}).start();

tcpie(host, [port], [options])

  • host string : the destination host name or IP address. Required.
  • port number : the destination port. Default: 22.
  • opts object : options for count, interval and timeout. Defaults: Infinity, 1000, 3000.

tcpie#start()

Start connecting

tcpie#stop()

Stops connecting

options object

  • count number : the number of connection attempts in milliseconds (default: Infinity).
  • interval number : the interval between connection attempts in milliseconds (default: 1000).
  • timeout number : the connection timeout in milliseconds (default: 3000).

Events

  • connect : Arguments: stats. Connection attempt succeeded.
  • timeout : Arguments: stats. Connection attempt ran into the timeout.
  • error : Arguments: err, stats. Connection attempt failed.
  • end : Arguments: stats. All connection attempts have finished.

stats argument properties

  • sent number : number of total attempts made.
  • success number : number of successfull attempts.
  • failed number : number of failed attempts.
  • target object : target details: host and port.

The following properties are present on all events except end:

  • rtt number : roundtrip time in milliseconds. undefined if failed.
  • socket object : socket details: localAddress, localPort, remoteAddress, remotePort.

© silverwind, distributed under BSD licence