mirror of
https://github.com/juanfont/headscale.git
synced 2026-02-23 13:50:36 +01:00
Fixes issue #2714 where the /debug/registration-cache endpoint would return "internal server error" when there were pending registrations due to JSON marshaling failure on "json: unsupported type: chan *types.Node". The issue occurred because the RegisterNode struct contains a channel field that cannot be serialized to JSON. The previous implementation was safe but minimal, only returning basic cache metadata. This enhancement: - Safely exposes cache item count using zcache.ItemCount() method - Exposes registration IDs without exposing the problematic RegisterNode structs - Maintains JSON serializability by avoiding channels completely - Provides more useful debug information while preserving safety Changes: - Enhanced DebugRegistrationCache() in hscontrol/state/debug.go to include item_count and registration_ids fields - Added comprehensive tests to verify JSON marshaling works correctly - Tests cover empty cache, single item, and multiple item scenarios The endpoint now returns useful debug information without the JSON marshaling error, resolving the issue reported in #2714. Co-authored-by: OpenAI Code Generation Assistant |
||
|---|---|---|
| .. | ||
| debug_registration_cache_test.go | ||
| debug_test.go | ||
| debug.go | ||
| endpoint_test.go | ||
| ephemeral_test.go | ||
| maprequest_test.go | ||
| maprequest.go | ||
| node_store_test.go | ||
| node_store.go | ||
| state.go | ||
| tags.go | ||
| test_helpers.go | ||