Initial vibeproxy implementation
Self-contained HTTP/HTTPS/TCP/UDP reverse proxy manager written in Go, with SQLite storage, a Bootstrap 5 admin UI (Go templates, no JS framework), and a REST API under /api/v1. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QTXFrNP1imCW7jtfL5SZrw
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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})
|
||||
}
|
||||
Reference in New Issue
Block a user