Manage external site-prober actions va API and Dashboard

This commit is contained in:
ayurishchev committed 2026-08-26 19:45:48 +03:00
1 parent f22ad569b6
commit 42f584dd3c
28 files changed
+717 -32

No files matched your search

+23
View File
@@ -29,6 +29,8 @@ type fakeControlAPI struct {
groups map[string][]string
checkTypes map[string]checkTypeDTO
fipSettleSeconds int
inboundPorts []int
inboundICMP bool
}
func newFakeControlAPI(t *testing.T) (*fakeControlAPI, string) {
@@ -206,6 +208,27 @@ func (f *fakeControlAPI) handler() http.Handler {
writeJSON(w, http.StatusOK, orchestratorSettingsDTO{FIPSettleSeconds: f.fipSettleSeconds})
})
mux.HandleFunc("GET /api/v1/admin/config/inbound-checks", func(w http.ResponseWriter, r *http.Request) {
f.mu.Lock()
defer f.mu.Unlock()
writeJSON(w, http.StatusOK, inboundChecksDTO{Ports: f.inboundPorts, ICMP: f.inboundICMP})
})
mux.HandleFunc("PUT /api/v1/admin/config/inbound-checks", func(w http.ResponseWriter, r *http.Request) {
f.mu.Lock()
defer f.mu.Unlock()
var req inboundChecksDTO
_ = json.NewDecoder(r.Body).Decode(&req)
for _, p := range req.Ports {
if p < 1 || p > 65535 {
writeAPIErr(w, http.StatusBadRequest, "port out of range")
return
}
}
f.inboundPorts = req.Ports
f.inboundICMP = req.ICMP
writeJSON(w, http.StatusOK, inboundChecksDTO{Ports: f.inboundPorts, ICMP: f.inboundICMP})
})
mux.HandleFunc("GET /api/v1/admin/config/validators", func(w http.ResponseWriter, r *http.Request) {
f.mu.Lock()
defer f.mu.Unlock()