StaxPing2 architecture and platform behavior
StaxPing2 keeps network collection and calculations independent from its
blessed interface. src/index.js owns CLI parsing, orchestration, key input,
and rendering; the remaining modules expose testable collectors and helpers.
config.js ──> index.js ──> ping.js ──> system ping process
│
├── traceroute.js ──> TTL-limited ping probes
├── checks.js ──> Node dns / net / http / https
├── probe.js ──> payload-size ping probes
└── history.js / export.js / layout.js
Live collection
Each target owns a long-running system ping process. Linux, macOS, and BSD
use ping -n -i; Windows uses ping -t. Pure parsers handle Unix reply and
summary formats plus Windows reply, timeout, loss, and RTT formats.
The collector keeps { t, ms } samples, using null for missed replies.
Statistics include last/minimum/average/maximum RTT, mean absolute
consecutive-sample jitter, interpolated p50 and p95 values, uptime percentage,
current outage duration, and longest outage. Expected-cadence accounting adds
misses while the monitor is running instead of waiting for a final ping
summary.
If a child process exits, the panel retains previous samples, displays its error, and schedules a restart after roughly ten seconds.
Path discovery
StaxPing2 implements path discovery by increasing ping TTL from one through
the configured maximum. It does not invoke traceroute and does not need raw
sockets or root. Probes run concurrently across configured hosts but
sequentially by hop within each host, and a second t press aborts them.
Linux, macOS, BSD, and Windows TTL-exceeded output is parsed. IPv4 intermediate
addresses are supported; IPv6 intermediate addresses currently render as *.
An unreachable response stops the trace, while a timeout records an unknown
hop and continues.
Reachability and MTU checks
- DNS uses
dns.lookupand reports addresses, latency, or the error code. - TCP uses
net.Socketand is useful where ICMP is blocked. - HTTP(S) uses the Node standard library and can enforce an expected status.
- MTU probing binary-searches the largest accepted ping payload and reports payload plus 28 bytes as an IPv4 MTU estimate.
These checks establish reachability; they are not packet capture, bandwidth measurement, or a replacement for service-level monitoring.
Modules
| Module | Responsibility |
|---|---|
src/index.js |
Terminal UI and orchestration. |
src/ping.js |
Ping supervision, parsing, statistics, and loss accounting. |
src/traceroute.js |
TTL sweep, hop parsing, aborts, and compact formatting. |
src/checks.js |
DNS, TCP, and HTTP(S) checks. |
src/probe.js |
Packet-size binary search. |
src/export.js |
Diagnostic snapshot construction. |
src/history.js |
Per-host rolling RTT history and atomic persistence. |
src/layout.js |
Pagination and host sorting. |
src/config.js |
Defaults, merge precedence, and validation. |
For implementation-level parser and state details, see the upstream architecture guide.