Skip to content

feat: show ICMP reply TTL and HTTP connection info in host details - #87

Merged
servak merged 9 commits into
mainfrom
feature/reply-ttl-conn-info
Nov 15, 2026
Merged

servak merged 9 commits into
mainfrom
feature/reply-ttl-conn-info

Conversation

@servak

@servak servak commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

Collect extra per-probe facts that help notice changes during maintenance (path length changes, DNS/LB switchover, certificate replacement) and show them in the host detail panel (v). Snapshots/compare will follow in a separate PR.

ICMP

  • Read the reply TTL (IPv4) / hop limit (IPv6) via x/net control messages (FlagTTL / FlagHopLimit only; combining with FlagSrc is rejected on darwin). Unsupported platforms (Windows) fall back silently to TTL unknown.
  • ICMPDetails.ReplyTTL and EstimateHops (return-path estimate from a guessed initial TTL of 64/128/255).
  • Detail panel: Reply TTL: 54 (≈10 hops, est.), the range over recent replies, and TTL changes.
  • A TTL change is recorded only after the new TTL is seen on 3 consecutive replies (applied in send order), so unequal-length ECMP paths show up as a range instead of flooding the change list.

HTTP

  • Remote IP:port of the final response (httptrace GotConn) and the leaf TLS certificate (subject CN, issuer, expiry, TLS version), recorded even with skip_verify.
  • Also recorded for rejected responses (status / body mismatch), so a switchover to a backend answering 503 updates the shown peer.
  • Certificate expiry is yellow within 30 days and red within 7 days.

Testing

  • Unit tests for EstimateHops, TTL tracking (debounce, range, cap, reset, out-of-order), HTTP conn info (TLS server, keep-alive on/off, redirects, rejected responses) and panel formatting.
  • Privileged integration test asserts ReplyTTL > 0 on the raw socket path (CI cap_net_raw step).
  • Verified live on macOS with sudo: 1.1.1.1 → TTL 54 (≈10 hops), 8.8.8.8 → TTL 114 (≈14 hops), https://1.1.1.1 shows remote, TLS 1.3 and certificate.
  • Not verified on real hardware: Linux raw socket (CI only), IPv6 hop limit, Windows runtime fallback.

…tificate

Read echo replies through the ipv4/ipv6 PacketConns with the TTL / hop
limit control message enabled and store it as ICMPDetails.ReplyTTL (0 when
unknown, e.g. on Windows where control messages are unsupported). Add
EstimateHops to estimate the return path hop count.

Capture the remote address of the final HTTP response's connection via
httptrace and a summary of the leaf certificate from resp.TLS.
Keep the last, minimum and maximum reply TTL of each host, and the most
recent 20 TTL changes (with a total count) between consecutive successful
replies. Changes are detected on the outage tracker's settled, send-ordered
result stream, so late replies cannot fake a change; reset clears them.
…st details

The host detail panel shows the reply TTL with the estimated return path
hop count, the observed range and the recent TTL changes, and for HTTP(S)
targets the remote address, TLS version and leaf certificate with its
expiry (yellow within 30 days, red within 7 days or expired).
Unexpected status / body failures (and body read errors) now carry the
HTTP details with the remote address and TLS info, so a switchover to a
peer that answers 503 is visible.
…eplies

Track the remote address / TLS info of the latest HTTP(S) response per
host, successful or not (newest send time wins, reset clears it), and
expose it via GetConnInfo. Compute the reply TTL last/min/max over the
history window instead of all time, so one transient TTL does not keep
the range forever. Move GetReplyTTL out of GetRTTPercentiles' doc comment.
Also document the recent-window TTL range and that rejected HTTP
responses update the shown peer.
… the new TTL

Replies alternating between ECMP paths of unequal length flooded the
change list. A different TTL now becomes a candidate and is recorded as a
change (timed at its first reply) once it is seen on 3 consecutive
successful replies; a reply with the confirmed TTL drops the candidate.
Failures and unknown TTLs neither advance nor clear it. The recent-history
range still shows the alternation.
@servak
servak merged commit 2839b70 into main Nov 15, 2026
5 checks passed
@servak
servak deleted the feature/reply-ttl-conn-info branch November 15, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant