rename: bridges/valves → tunnels (one term across types + API + UI)
CI / validate (push) Successful in 7s
CI / docker (push) Failing after 5s

API shape:
  GET /api/connections → GET /api/tunnels
  body: {"connections": […]} → {"tunnels": […]}

Type rename (package stays "bridge" — internal):
  Valve         → Listener
  clientBridge  → tunnel
  ConnSnapshot  → TunnelSnapshot

Log messages mirror the new vocab ("listener open/close", "tunnel
open/idle evict/forward failed"). UI header is now "Active tunnels"
and the empty state reads "no active tunnels".

server-manager's dashboard polls /infra/svc-proxy/api/tunnels and
shows "N tunnels" on the svc-proxy infra card.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 18:48:17 +02:00
parent 7fbe2555fb
commit 41a7e39754
5 changed files with 163 additions and 160 deletions
+4 -4
View File
@@ -40,7 +40,7 @@ func New(addr string, mgr *bridge.Manager, bus *LogBus) *Server {
panic(err) // embed.FS misconfigured at build time
}
mux.Handle("GET /", http.FileServer(http.FS(sub)))
mux.HandleFunc("GET /api/connections", s.handleConnections)
mux.HandleFunc("GET /api/tunnels", s.handleTunnels)
mux.HandleFunc("GET /api/logs", sseLogs(bus))
s.srv = &http.Server{
@@ -66,13 +66,13 @@ func (s *Server) Run(ctx context.Context) error {
return nil
}
func (s *Server) handleConnections(w http.ResponseWriter, _ *http.Request) {
func (s *Server) handleTunnels(w http.ResponseWriter, _ *http.Request) {
snap := s.mgr.Snapshot()
// Sort by most-recently-active first so the UI can render top-down.
sort.Slice(snap, func(i, j int) bool { return snap[i].LastSeen.After(snap[j].LastSeen) })
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(map[string]any{
"connections": snap,
"at": time.Now(),
"tunnels": snap,
"at": time.Now(),
})
}