headscale
headscale copied to clipboard
feat(ping): add core PingRequest/Response implementation
Adds core ping functionality for node health checks and connectivity testing.
Changes
- PingManager: Manages ping request lifecycle, tracking, and response handling
- PingRequest types: Support for disco, TSMP, and c2n ping types
- Noise protocol integration: Authenticated ping response handler
-
HTTP endpoint:
/machine/ping-response/{request_id}for receiving responses - Interface extension: Uses SendDirectUpdate method for direct message delivery
Implementation Details
The PingManager creates unique ping requests with callback URLs, tracks them with timeouts, and coordinates responses. The Noise protocol ensures only authenticated nodes can submit ping responses.
This builds on the SendDirectUpdate capability from the previous commit and provides the foundation for gRPC ping endpoints and the scheduler.
Context
Part of the work discussed in #2902 to add ping functionality to headscale.
Dependencies
- Requires PR #2938 (SendDirectUpdate method)
Note: This code was generated with assistance from Claude Sonnet 4.5 via cline.bot