Commit Graph

11 Commits

Author SHA1 Message Date
Kristoffer Dalby f6aea642d3 all: scrub stale gRPC references from comments and docs
Reword comments and docs that still named the removed gRPC stack, rename
the GRPCSortable test interface, and drop the dead gRPC port note from the
dev README.
2026-06-19 05:58:10 +00:00
Kristoffer Dalby 18f7048c58 hscontrol/api: map missing-node errors to 404
RenameNode and ExpireNode surface ErrNodeNotInNodeStore for an unknown
node; mapStateError only knew ErrNodeNotFound, so they 500'd. Treat both
as not found.
2026-06-19 05:58:10 +00:00
Kristoffer Dalby a9d5ec6202 hscontrol/api: return a minimal 401 for failed security requirements
ogen's SecurityError message echoes the operation name and internal
security text. Map it to a clean 401 so the unauthorized body stays small
and leaks nothing.
2026-06-19 05:58:10 +00:00
Kristoffer Dalby b5e3b4ee27 hscontrol/api/v1: build responses from state views, not proto
Convert directly from NodeView/UserView/PreAuthKeyView (no AsStruct copies, no
proto bridge), preserving the view types on the read path. Add UserView.Username
and drop the two state.go uses of PreAuthKey.Proto().
2026-06-19 05:57:04 +00:00
Kristoffer Dalby 29fc14dd73 cmd/headscale: run the CLI on the generated v1 HTTP client
Serve the API over the unix socket (auth bypassed; socket permissions are the
trust boundary) and convert every CLI command from the gRPC client to the
generated ogen client. Remote CLI now uses the HTTP API URL.
2026-06-19 05:57:04 +00:00
Kristoffer Dalby de85965bd8 hscontrol/api/v1: implement auth and policy endpoints
AuthRegister/Approve/Reject and GetPolicy/SetPolicy/CheckPolicy over the state
layer, completing all v1 operations. HTTP-parity tests included.
2026-06-19 05:57:04 +00:00
Kristoffer Dalby 83fb0a4548 hscontrol/api/v1: implement node endpoints
Register, Get, List, Delete, Rename, Expire, SetTags, SetApprovedRoutes (with
exit-route expansion), BackfillNodeIPs, DebugCreateNode over the state layer.
Tagged nodes present as TaggedDevices; client errors map to 4xx.
2026-06-19 05:57:04 +00:00
Kristoffer Dalby fc26c447ec hscontrol/api/v1: implement pre-auth key endpoints
CreatePreAuthKey (with ACL tag validation), ListPreAuthKeys, ExpirePreAuthKey,
DeletePreAuthKey over the state layer, with HTTP-parity tests.
2026-06-19 05:57:04 +00:00
Kristoffer Dalby df6876a570 hscontrol/api/v1: implement API key endpoints
CreateApiKey, ListApiKeys, ExpireApiKey, DeleteApiKey (by id or prefix) over
the state layer, with HTTP-parity tests.
2026-06-19 05:57:04 +00:00
Kristoffer Dalby fe76fe0f57 hscontrol/api/v1: implement user endpoints
CreateUser, ListUsers (with filters), RenameUser, DeleteUser over the state
layer; unknown users now 404. HTTP-parity tests via the generated client.
2026-06-19 05:57:04 +00:00
Kristoffer Dalby 562fcc1401 hscontrol: serve v1 API via ogen, replace grpc-gateway facade
Mount the ogen-generated server at /api/v1 with bearer-auth and RFC 7807
errors backed by the state layer; gRPC servers stay for the CLI. Add a
servertest API client harness and Health parity tests.
2026-06-19 05:57:03 +00:00