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 |
||
|---|---|---|
| .. | ||
| assets | ||
| capver | ||
| db | ||
| derp | ||
| dns | ||
| mapper | ||
| policy | ||
| routes | ||
| state | ||
| templates | ||
| types | ||
| util | ||
| app.go | ||
| auth_tags_test.go | ||
| auth_test.go | ||
| auth.go | ||
| debug.go | ||
| grpcv1_test.go | ||
| grpcv1.go | ||
| handlers.go | ||
| metrics.go | ||
| noise.go | ||
| oidc_template_test.go | ||
| oidc_test.go | ||
| oidc.go | ||
| platform_config.go | ||
| poll.go | ||
| tailsql.go | ||
| templates_consistency_test.go | ||