Documentation
¶
Overview ¶
Package api serves the Scout REST API under /scout/api/ and the live WebSocket at /scout/ws/live.
Index ¶
Constants ¶
const (
TokenTTL = 12 * time.Hour
)
Auth defaults.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth issues and verifies dashboard JWTs (HS256) and rate-limits logins.
func (*Auth) Login ¶
Login checks credentials and returns a token. Failed attempts are counted per client IP; after maxFailures in failureWindow, logins return 429.
func (*Auth) Middleware ¶
func (a *Auth) Middleware() gin.HandlerFunc
Middleware rejects requests without a valid token. It reads the Authorization: Bearer header, or ?token= for WebSocket upgrades.
type Deps ¶
type Deps struct {
Auth *Auth
Store storage.Store
Engine *engine.Engine
Bus *engine.Bus
Kill *engine.KillSwitch
Settings Settings
Scoring scoring.Options
// Go runs background work (scans) tied to Scout's lifecycle, so shutdown
// cancels and waits for it.
Go func(func(ctx context.Context))
Logger *slog.Logger
// Schedules lists configured schedules with next run times.
Schedules func() any
// AI is the optional AI client; nil means AI features are off.
AI *ai.Client
}
Deps are what the API needs. The root package wires them in, so api never imports it.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves /scout/api/* and /scout/ws/live.
func (*Server) Register ¶
func (s *Server) Register(g *gin.RouterGroup)
Register mounts the API on the /scout group.
type Settings ¶
type Settings struct {
AppName string `json:"app_name"`
Environment core.Environment `json:"environment"`
Mode core.Mode `json:"mode"`
Targets []core.Target `json:"targets"`
Scope core.Scope `json:"scope"`
Criticality []scoring.CriticalityRule `json:"criticality"`
RateLimit int `json:"rate_limit"`
Concurrency int `json:"concurrency"`
CheckTimeout time.Duration `json:"check_timeout_ns"`
Retention time.Duration `json:"retention_ns"`
Window any `json:"window,omitempty"`
Version string `json:"version"`
}
Settings is the read-only configuration the dashboard shows. It never carries secrets.