Add per-device routing long-tail: hosts, providers, routes, routing_rules
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful

Storage + CRUD (migration 0006, model, id-keyed store, REST handlers) plus
compiler rendering: each section is owned by a device and projected into that
device's rendered config (hosts/providers/routes/routing_rules).
This commit is contained in:
benvin
2026-07-26 00:12:19 +10:00
committed by Ben Vincent
parent bd97b13ff7
commit 721f4c1af3
7 changed files with 667 additions and 26 deletions
+10
View File
@@ -61,6 +61,7 @@ func (s *Server) mountResources(r chi.Router) {
})
s.mountNAT(r)
s.mountLongtail(r)
s.mountPerDevice(r)
}
// respondOne writes a single resource, mapping ErrNotFound to 404.
@@ -76,6 +77,15 @@ func respondOne(w http.ResponseWriter, v any, err error) {
writeJSON(w, http.StatusOK, v)
}
// respondCreated writes a 201 with the created resource, or 500 on error.
func respondCreated(w http.ResponseWriter, v any, err error) {
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error())
return
}
writeJSON(w, http.StatusCreated, v)
}
// respondDelete maps a delete result to 204/404/500.
func respondDelete(w http.ResponseWriter, err error) {
if err != nil {