This commit is contained in:
developer committed 2026-09-28 10:37:15 +00:00
1 parent d94e4cf6a8
commit b2cd7d4b91
13 files changed
+542 -26

No files matched your search

+31
View File
@@ -177,6 +177,37 @@ func (s *Server) handleDomainCheck(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, v)
}
// handleDNSTest answers one query through the live pipeline. It is the
// console's "is my DNS actually answering" button: the answer comes from the
// same engine the listeners use, so what it shows is what a client gets, and
// a query error is reported inside the payload rather than as a status code —
// a failed lookup is a result here, not a failed request.
func (s *Server) handleDNSTest(w http.ResponseWriter, r *http.Request) {
if s.hooks.Resolve == nil {
writeError(w, http.StatusNotImplemented, "dns test not available")
return
}
var in struct {
Name string `json:"name"`
QType string `json:"type"`
}
if err := decodeJSON(r, &in); err != nil {
writeError(w, http.StatusBadRequest, "malformed request body")
return
}
name := strings.TrimSpace(in.Name)
if name == "" {
writeError(w, http.StatusBadRequest, "name is required")
return
}
v, err := s.hooks.Resolve(r.Context(), name, in.QType)
if err != nil {
writeJSON(w, http.StatusOK, map[string]any{"name": name, "error": err.Error()})
return
}
writeJSON(w, http.StatusOK, v)
}
func (s *Server) handleLocalZones(w http.ResponseWriter, r *http.Request) {
if s.hooks.LocalZones == nil {
writeError(w, http.StatusNotImplemented, "local zone editor is unavailable")