fix(api): SNMP/hosts — одна строка на IP (DISTINCT ON), лимиты для больших сканов

Made-with: Cursor
This commit is contained in:
Луценко Андрей Анатольевич
2026-04-10 15:35:45 +10:00
parent 009aeb5dbf
commit a36edbc26b
4 changed files with 69 additions and 36 deletions
+6 -6
View File
@@ -181,11 +181,11 @@ func (h *Handler) getScanHosts(w http.ResponseWriter, r *http.Request) {
return
}
limit := 500
limit := 200000
if raw := r.URL.Query().Get("limit"); raw != "" {
n, err := strconv.Atoi(raw)
if err != nil || n <= 0 || n > 5000 {
writeError(w, http.StatusBadRequest, "limit must be between 1 and 5000")
if err != nil || n <= 0 || n > 500000 {
writeError(w, http.StatusBadRequest, "limit must be between 1 and 500000")
return
}
limit = n
@@ -233,11 +233,11 @@ func (h *Handler) getScanSNMP(w http.ResponseWriter, r *http.Request) {
return
}
limit := 1000
limit := 200000
if raw := r.URL.Query().Get("limit"); raw != "" {
n, err := strconv.Atoi(raw)
if err != nil || n <= 0 || n > 10000 {
writeError(w, http.StatusBadRequest, "limit must be between 1 and 10000")
if err != nil || n <= 0 || n > 500000 {
writeError(w, http.StatusBadRequest, "limit must be between 1 and 500000")
return
}
limit = n