How unight0/lorebox works
Lorebox is a single-binary Git server that serves both as a pull-through mirror and, optionally, a host for user-owned repositories. Git clients request repositories through the server; misses are cloned from upstream and cached, while cached repositories are served using Git’s smart HTTP protocol or a dumb-protocol fallback. Owners and administrators also manage repositories through authenticated APIs and matching CLI commands. The graph includes documented refresh, eviction, auth, browsing, and TLS capabilities. Several server subsystems are described in the README but their implementation was not sampled, so those links cite the documentation.
Main entry points: main.go HTTP server · api.go Admin API · git.go Git repository operations · client.go Remote-control CLI
Components 19
Git serving
- HTTP server
main.go - Pull-through fetch
main.go - Smart HTTP
main.go - Dumb HTTP
dumb.go - Repository browsing
pages.go
Repository lifecycle
- Repository store
- Git repository operations
git.go - Background refresh
main.go - Disk budget and eviction
main.go
Remote control
- Remote-control CLI
client.go - Admin API
api.go - Self-hosted API
api.go - Token authentication
main.go - Git credential helper
client.go
Runtime support
- HTTPS and TLS reload
tls.go - Git HTTP backend
Other components
- Git clients
- Upstream Git hosts
- Admins and owners
Connections 24
- Git clients → HTTP server: requests repositories
README.md - HTTP server → Pull-through fetch: fetches cache misses
main.go - Pull-through fetch → Upstream Git hosts: clones upstream
README.md - Pull-through fetch → Repository store: caches mirrors
README.md - HTTP server → Smart HTTP: routes smart requests
main.go - Smart HTTP → Git HTTP backend: serves Git protocol
README.md - HTTP server → Dumb HTTP: routes fallback requests
main.go - Dumb HTTP → Repository store: reads repository files
dumb.go - HTTP server → Git repository operations: initializes repositories
main.go - Git repository operations → Repository store: updates repository metadata
git.go - Background refresh → Repository store: refreshes mirrors
README.md - Disk budget and eviction → Repository store: evicts eligible mirrors
main.go - Admins and owners → Remote-control CLI: runs commands
README.md - Remote-control CLI → Admin API: sends admin requests
README.md - Admin API → Git repository operations: pins repositories
api.go - Admin API → Pull-through fetch: requests fetch or refresh
api.go - Admin API → Disk budget and eviction: requests eviction
README.md - Remote-control CLI → Self-hosted API: sends owner requests
README.md - Self-hosted API → Git repository operations: creates Git repositories
api.go - Self-hosted API → Repository store: deletes hosted repositories
api.go - HTTP server → Token authentication: authorizes requests
README.md - Git credential helper → HTTP server: supplies Git credentials
README.md - HTTP server → Repository browsing: serves repository listings
README.md - HTTP server → HTTPS and TLS reload: serves HTTPS
README.md