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:
2026-08-17 10:28:59 -05:00
co-authored by Claude Sonnet 5
commit ba1f7c4c03
105 changed files with 9142 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
package web
import (
"net/http"
"github.com/owen/vibeproxy/internal/database"
)
func (h *Web) handleRequestLogs(w http.ResponseWriter, r *http.Request) {
page := atoiDefault(r.URL.Query().Get("page"), 1)
if page < 1 {
page = 1
}
const pageSize = 50
f := database.LogFilter{
Search: r.URL.Query().Get("q"),
Status: atoiDefault(r.URL.Query().Get("status"), 0),
Limit: pageSize,
Offset: (page - 1) * pageSize,
}
logs, total, err := database.QueryRequestLogs(h.db, f)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
totalPages := (total + pageSize - 1) / pageSize
if totalPages < 1 {
totalPages = 1
}
render(w, "logs", PageData{
Active: "logs", Title: "Request Logs",
Data: map[string]any{"Logs": logs, "Total": total, "Page": page, "TotalPages": totalPages, "Query": f.Search, "Status": f.Status},
})
}
func (h *Web) handleAuditLogs(w http.ResponseWriter, r *http.Request) {
page := atoiDefault(r.URL.Query().Get("page"), 1)
if page < 1 {
page = 1
}
const pageSize = 50
logs, total, err := database.ListAuditLogs(h.db, pageSize, (page-1)*pageSize)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
totalPages := (total + pageSize - 1) / pageSize
if totalPages < 1 {
totalPages = 1
}
render(w, "logs_audit", PageData{
Active: "logs", Title: "Audit Log",
Data: map[string]any{"Logs": logs, "Total": total, "Page": page, "TotalPages": totalPages},
})
}