Most public looking glasses are outdated CGI or raw PHP scripts from 1997. They parse user inputs insecurely, lack any form of caching, and put a heavy CPU load on core routers during diagnostics. When core public routers go down, troubleshooting BGP route flaps at 3 AM becomes a nightmare.

To solve this, I built Looking Glass — a stateless, horizontally scalable, and secure diagnostic daemon built with Go, ConnectRPC, and Svelte 5. It manages a fleet of multi-vendor core routers over concurrent, isolated SSH sessions and streams real-time diagnostic outputs through a raw API, a neat CLI (lg-cli), and a snappy web client.

graph TD
    ClientCLI[lg-cli Client] -->|ConnectRPC HTTP/2| Server[Looking Glass Server Daemon]
    SvelteUI[SvelteKit UI] -->|HTTP/2 API| Server
    Server -->|Read/Write Cache| Redis[Redis Memory Cache & Sync]
    Server -->|Concurrent SSH| Routers[Fleet of Core Routers <br>FRRouting, Cisco, Juniper, etc.]

Key architectural decisions

  • Stateless by Design: No local storage, no databases, and absolutely no painful database migrations. Replicas scale out horizontally behind Traefik or Nginx, sharing a lightweight Redis instance for performance caching and clustering health checks.
  • Embed-Stable Assets: By taking advantage of Go’s compiler tricks, the entire SvelteKit frontend build is embedded directly into the Go server binary using go:embed. This yields a single, zero-dependency, statically-linked binary under 20MB.
  • Decoupled YAML Specs: Decoupled command definitions entirely from the Go codebase. Each router vendor (Cisco IOS, Arista EOS, Nokia SR OS, FRRouting) is modeled as a YAML specification containing Go text/template blocks.
  • Redis Lease Locking: Gated health check sweeps via Redis SetNX locks with a 70-second TTL to avoid "probe multiplier storms" on production edge routers across horizontal server replicas.
  • API-First & ConnectRPC: From day one, designed to speak ConnectRPC, supporting statically-typed contracts (lookingglass.proto), cross-language client generation, and multi-protocol transports (gRPC, gRPC-Web, JSON-over-HTTP).
  • 60fps UI Diffing: Svelte 5 frontend with Web Worker offloading. Calculations for comparing large BGP routing tables are run on a background worker (diff.worker.ts) to keep the browser UI running at a silky-smooth 60fps without stuttering.

The project is fully open source and actively developed on GitHub.