Extract the Central networking functionality from wild-cloud/api into a standalone service. Wild Central manages DNS (dnsmasq), gateway (HAProxy), firewall (nftables), VPN (WireGuard), TLS (certbot), security (CrowdSec), and DDNS — all the network appliance concerns. All Cloud-specific code (instances, clusters, nodes, apps, backups, operations, kubectl/talosctl tooling) has been removed. The API struct and route registration contain only Central endpoints. Tests updated to match the new API signature. Builds and all tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
30 lines
737 B
Go
30 lines
737 B
Go
package v1
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
// DDNSStatus returns the current DDNS status (last IP, last update, last error)
|
|
func (api *API) DDNSStatus(w http.ResponseWriter, r *http.Request) {
|
|
if api.ddns == nil {
|
|
respondJSON(w, http.StatusOK, map[string]any{
|
|
"enabled": false,
|
|
"message": "DDNS not configured",
|
|
})
|
|
return
|
|
}
|
|
respondJSON(w, http.StatusOK, api.ddns.GetStatus())
|
|
}
|
|
|
|
// DDNSTrigger forces an immediate DDNS IP check and update
|
|
func (api *API) DDNSTrigger(w http.ResponseWriter, r *http.Request) {
|
|
if api.ddns == nil {
|
|
respondError(w, http.StatusServiceUnavailable, "DDNS not configured")
|
|
return
|
|
}
|
|
api.ddns.Trigger()
|
|
respondJSON(w, http.StatusOK, map[string]string{
|
|
"message": "DDNS update triggered",
|
|
})
|
|
}
|