DNS pinger — sends one UDP query to server, waits for a
well-formed response, and reports the round trip. The query
content (query + record_type) is sent as-is; the response is
validated only structurally (matching ID, response bit set, RCODE
= NoError). Whether the answer section carries useful records is
not checked — this is a “did the server respond” probe, not a
resolver.
gRPC server-streaming pinger — calls the standard
grpc.health.v1.Health/Watch RPC and waits for the broker’s first
HealthCheckResponse. Per the spec, the server must send the
current status immediately on subscribe, so this measures the
real “open server stream → first message” RTT, not just connection
setup.
HTTP / HTTPS pinger — opens a TCP connection (optionally wrapped in
TLS for https://), writes a single HTTP/1.1 request, reads the
response, and reports success based on the status line.
NTP pinger — sends a 48-byte NTP v4 client packet to server and
waits for a server reply. Default port 123. Doesn’t decode the
timestamps — this is a “did the time server respond well-formedly”
probe, not a clock-discipline tool.
QUIC pinger. Reports the time taken to complete the QUIC handshake
(UDP + Initial / Handshake / 1-RTT keys ready). Doesn’t open
streams or speak HTTP/3 frames — handshake completion IS the
success signal.
STUN pinger — sends a Binding Request to server and waits for a
Binding Success Response. Default port 3478. Doesn’t extract the
XOR-MAPPED-ADDRESS attribute — this is a “did the STUN server
answer correctly” probe, not a NAT-mapping discovery tool.
TLS handshake pinger — measures the time to complete a TLS
handshake against target. The handshake covers TCP connect +
ClientHello + ServerHello + Certificate + (key exchange) +
Finished; we don’t send any application data on top, just bring
the session to the point where it’s ready and close.
TURN pinger — sends an unauthenticated Allocate Request to server
and considers the expected 401 Unauthorized Allocate Error
Response a successful ping (it proves the server is alive and
speaks RFC 5766). Default port 3478. Doesn’t actually allocate any
relay state, so it’s safe to spam against shared TURN
infrastructure.
Trait every protocol implementation provides. async fn is wrapped
by async-trait so the trait stays object-safe — knockknock
dispatches via Box<dyn Pinger> and that requires dyn-safety.
Resolve url’s host:port to a list of socket addresses for display.
Falls back to scheme default ports (http → 80, https → 443) when
the URL has no explicit port. Returns an empty Vec if DNS lookup
fails or the host is empty — callers (the CLI in particular)
treat the result as informational and let the actual pinger
surface the real error.