Skip to content

PingKit 0.2.0

Choose a tag to compare

@gewill gewill released this 13 Jul 06:41
· 26 commits to main since this release

New

ICMP traceroute

Tracer sends echo requests with increasing TTL on the same unprivileged ICMP socket and matches Time Exceeded answers from intermediate routers:

for try await hop in Tracer(host: "8.8.8.8").hops { ... }
let route = try await Tracer.trace("8.8.8.8")

One TracerouteHop per TTL groups the configurable per-hop probes; the trace ends at the destination's echo reply, a Destination Unreachable, or maxHops. Same single-consumer / cancellation / stop() lifecycle as Pinger. CLI: ping-cli trace <host>. Verified live against 8.8.8.8 (15-hop route).

Kernel receive timestamps

RTTs on Apple platforms are now measured against the kernel's packet-arrival timestamps (SO_TIMESTAMP_MONOTONIC), removing scheduler wakeup latency — measured ~0.18 ms tighter on loopback (avg 0.34 ms → 0.10 ms, stddev 0.13 → 0.02 ms).

Breaking (0.x)

PingSocket.activate now delivers a MonotonicTimestamp instead of ContinuousClock.Instant, and gained setTimeToLive(_:). Only affects custom PingSocket implementations; the Pinger/Tracer API is unchanged.

Known limitations

On Linux, ICMP errors go to the socket error queue (MSG_ERRQUEUE), which PingKit doesn't read yet — traceroute intermediate hops show as timeouts there.

🤖 Generated with Claude Code