package web import "net/http" type backendRow struct { ProxyHostID int64 ProxyHostName string Host string Port int Weight int Enabled bool Healthy bool HealthCheck string } func (h *Web) handleBackendsList(w http.ResponseWriter, r *http.Request) { snap := h.store.Current() seen := map[int64]bool{} var rows []backendRow for _, rt := range snap.HostsByDomain { if seen[rt.Model.ID] || rt.Pool == nil { continue } seen[rt.Model.ID] = true for _, b := range rt.Pool.Backends { rows = append(rows, backendRow{ ProxyHostID: rt.Model.ID, ProxyHostName: rt.Model.Name, Host: b.Model.Host, Port: b.Model.Port, Weight: b.Model.Weight, Enabled: b.Model.Enabled, Healthy: b.Healthy(), HealthCheck: string(b.Model.HealthCheckType), }) } } render(w, "backends", PageData{Active: "backends", Title: "Backends", Data: rows}) }