Skip to content

api: expose node endpoints on GET /api/v1/node#3181

Open
bigbozza wants to merge 1 commit into
juanfont:mainfrom
bigbozza:expose-node-endpoints
Open

api: expose node endpoints on GET /api/v1/node#3181
bigbozza wants to merge 1 commit into
juanfont:mainfrom
bigbozza:expose-node-endpoints

Conversation

@bigbozza

@bigbozza bigbozza commented Apr 10, 2026

Copy link
Copy Markdown

Related: #2152 Related: #2272

Summary

The headscale database already persists each node's current endpoints ([]netip.AddrPort) via GORM JSON serialisation, populated from UpdateNodeFromMapRequest. However, this field was not surfaced in the REST API response, making it unavailable to operators building external tooling (network maps, dashboards, audit logs).

Change

Added repeated string endpoints = 27 to proto/headscale/v1/node.proto (new field number, fully wire-compatible; the old field 16 comment is preserved)

Added EndpointsAsString() []string helper on types.Node to convert []netip.AddrPort to strings

Populated Endpoints in the v1.Node proto conversion, so both GetNode and ListNodes return the field

Regenerated node.pb.go and headscale.swagger.json via buf generate

Added TestGetNode_IncludesEndpoints in grpcv1_test.go that persists endpoints via UpdateNodeFromMapRequest and asserts GetNode returns them; test passes

Use case

Operators running external tooling against the headscale API currently have no way to retrieve a node's active endpoints without querying the database directly. This change makes the information available through the existing REST surface with no breaking changes.

Maintenance

The field is derived entirely from the existing types.Node.Endpoints value; no new persistence, migration, or external dependency is introduced.

  • have read the CONTRIBUTING.md file
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

@aalmenar

Copy link
Copy Markdown

This is an interesting pull request to provide more information at least that can be used in web interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants