mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-10-16 20:20:07 +00:00
feat(ws): opt-in allowed origins and observer key (#170)
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
type Options struct {
|
||||
MaxConnsPerIP int
|
||||
MaxConnectsPerMinute int
|
||||
WSAllowedOrigins []string
|
||||
CORS config.CORSConfig
|
||||
Server config.ServerConfig
|
||||
Auth config.AuthConfig
|
||||
|
||||
@@ -91,7 +91,7 @@ func New(h *hub.Hub, reader api.Reader, workers []*ingest.Worker, opts Options)
|
||||
))
|
||||
|
||||
// ── WebSocket ────────────────────────────────────────────────────────────
|
||||
r.Get("/ws", ws.Handler(h, reader, opts.MaxConnsPerIP, opts.MaxConnectsPerMinute))
|
||||
r.Get("/ws", ws.Handler(h, reader, opts.MaxConnsPerIP, opts.MaxConnectsPerMinute, opts.WSAllowedOrigins))
|
||||
|
||||
// ── Public REST API (v1) ─────────────────────────────────────────────────
|
||||
r.Route("/api/v1", func(r chi.Router) {
|
||||
|
||||
Reference in New Issue
Block a user