feat: add ICMP ping column to peer table
- ping_batch() pings each peer's public IP in parallel from the host (system ping, 1 packet, 1 s timeout, private IPs skipped) - New "Ping" column next to stellar-core's "Latency" in the -p/-g table; "—" when the peer filters ICMP - Low ping with high latency hints at a VPN exit / relay in front of the actual node Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,7 @@ Single self-contained script (`pi-stat`). Logic is split into helper functions a
|
||||
- **PostgreSQL** — `psql` inside the container; used for peer DB counts and pubkey→IP mapping
|
||||
- **ZFS CLI** — `zpool`/`zfs` commands on the host for disk health (`z01pool`); if `zpool` is not found (`HAS_ZFS = False`), falls back to `shutil.disk_usage()` — works on Linux without ZFS, WSL2, and Windows
|
||||
- **ip-api.com** — batch geolocation (Country, City), cached in `_geo_cache`; only fetched with `-g`
|
||||
- **System `ping`** — one ICMP ping per peer IP from the host (`ping_batch()`, parallel, 1 s timeout, private IPs skipped); shown as `Ping` next to stellar-core's `Latency` in the `-p`/`-g` table, `—` if the peer filters ICMP
|
||||
|
||||
### Output sections (in order)
|
||||
|
||||
@@ -75,6 +76,7 @@ The refresh deadline is anchored to the start of the cycle (`cycle_start`), not
|
||||
- **Dynamic column widths** — all table columns sized at runtime from actual data length
|
||||
- **NAT detection** — inbound peers with private IPs are replaced with their DB-stored public IP (`db_peer_addr` from PostgreSQL)
|
||||
- **Validator matching** — `load_validators()` parses `stellar-core.cfg` and indexes by IP, name, and public key; matched peers show a truncated key + `(Vn)` label
|
||||
- **Ping vs. Latency** — `Latency` is stellar-core's round trip to the peer *process*, `Ping` is ICMP to the peer's IP; a low ping with high latency hints at a VPN exit / relay in front of the actual node
|
||||
- **Geo caching** — `_geo_cache` is a module-level dict; `geo_batch()` only fetches IPs not already cached
|
||||
- **Flag parsing** — manual `sys.argv` parsing; `-g` implies `-p`; `-i` accepts an optional next argument as the refresh interval
|
||||
- **Config precedence** — `config_refresh()` reads the config value; an explicit `-i SEC` argument overrides it
|
||||
|
||||
Reference in New Issue
Block a user