mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-10-16 20:20:07 +00:00
Stats endpoints read hourly rollup tables filled once per closed hour by one advisory-locked task, instead of materialized views that re-scanned every observation on each refresh. IATA-set tables give exact distinct counts for any IATA set or region. Cleanup holds raw rows for unrolled hours (up to 24h). Adds /stats/series; ingest keeps packet observation counts, observer last IATA, channel message counts and trace tag summaries. 001_baseline.sql is rewritten, so pre-release 2.0 databases must be recreated. See docs/historical-stats.md.
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
// Copyright 2026 Beacon Contributors
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
package router
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/MeshCore-Beacon/beacon-server/internal/api/handlers"
|
|
"github.com/MeshCore-Beacon/beacon-server/internal/config"
|
|
)
|
|
|
|
// Options names the startup settings used by the router. Adding an optional
|
|
// route does not change New's signature or require unrelated callers to change.
|
|
type Options struct {
|
|
MaxConnsPerIP int
|
|
MaxConnectsPerMinute int
|
|
WSAllowedOrigins []string
|
|
CORS config.CORSConfig
|
|
Server config.ServerConfig
|
|
Auth config.AuthConfig
|
|
RateLimit config.ResolvedRateLimitConfig
|
|
Scopes handlers.ScopeMembership // region-filtered scope lists; nil lists none
|
|
RollupRetention time.Duration // longest historical stats window
|
|
// AdminRoutes mounts operator-only subrouters at literal paths such as
|
|
// "/accounts". Each feature owns its dependencies, methods and handlers.
|
|
// The router applies authentication to every path and method in this group.
|
|
AdminRoutes map[string]http.Handler
|
|
}
|