How saprayworld/pigate works
PiGate is a web-administered Raspberry Pi firewall and gateway. Administrators use the React SPA to authenticate and manage network, DNS/DHCP, firewall, QoS, WAN failover, users, and system settings; the Go API coordinates configuration and statistics with SQLite and Linux networking/services. The README documents broad feature coverage, but sampled source is concentrated in routing, API setup, and frontend statistics/auth; unsampled subsystem links are therefore omitted or marked unverified rather than treated as observed calls.
Main entry points: interfaces.go Kernel Interfaces · router.go HTTP API · App.tsx Admin SPA · service Network Services
Components 22
Administration UI
- Admin SPA
frontend/src/App.tsx - Session UI
frontend/src/services/authService.ts - Network Management
frontend/src/pages/StaticRoutes.tsx - Statistics Views
frontend/src/services/statisticsService.ts - DNS Management
frontend/src/services/dnsServerService.ts
API and Services
- HTTP API
backend/internal/api/router.go - Request Handlers
backend/internal/api/handlers.go - WAN Handlers
backend/internal/api/wan_handlers.go - Network Services
backend/internal/service - Route Coordination
backend/internal/service/routing.go - DNS Services
backend/internal/service - Traffic Statistics
backend/internal/service - User Management
backend/internal/service
Configuration Storage
- SQLite Repositories
backend/internal/db/repository.go - Domain Models
backend/internal/model/types.go
Linux Control
- Kernel Interfaces
backend/internal/kernel/interfaces.go - Network and Firewall
backend/internal/kernel/real_network.go - DNS Runtime
backend/internal/kernel/dns_server.go - System Services
backend/internal/kernel/real_system_service.go - RAM Log Buffer
backend/internal/logs/ringbuffer.go
Other components
- Administrator
- Browser
Connections 19
- Administrator → Admin SPA: uses
README.md - Browser → Admin SPA: loads
- Admin SPA → Session UI: checks session
frontend/src/App.tsx - Session UI → HTTP API: auth requests
frontend/src/services/authService.ts - Admin SPA → Network Management: routes to
frontend/src/App.tsx - Network Management → HTTP API: fetches routes
- DNS Management → HTTP API: DNS requests
frontend/src/services/dnsServerService.ts - Statistics Views → HTTP API: fetches statistics
frontend/src/services/statisticsService.ts - HTTP API → Request Handlers: dispatches
- Request Handlers → Network Services: coordinates
- WAN Handlers → Network Services: coordinates WAN
- Network Services → SQLite Repositories: persists config
- Network Services → Kernel Interfaces: controls system
- Route Coordination → Kernel Interfaces: manages routes
backend/internal/service/routing.go - SQLite Repositories → Domain Models: stores records
- Kernel Interfaces → Network and Firewall: implements control
- Kernel Interfaces → DNS Runtime: implements DNS
- Kernel Interfaces → System Services: uses D-Bus
- Traffic Statistics → RAM Log Buffer: buffers logs