Documentation
¶
Overview ¶
Package dashboard provides HTTP handlers and API endpoints for AegisGate's real-time monitoring interface.
Package dashboard provides HTTP handlers and API endpoints for AegisGate's real-time monitoring interface.
Index ¶
- type APIResponse
- type AdminHandler
- type ComponentStatus
- type Config
- type Dashboard
- func (d *Dashboard) GetComponentStatus() []ComponentStatus
- func (d *Dashboard) GetI18nManager() *i18n.Manager
- func (d *Dashboard) GetSystemMetrics() map[string]interface{}
- func (d *Dashboard) HandleLocale(w http.ResponseWriter, r *http.Request) error
- func (d *Dashboard) HandleSetLocale(w http.ResponseWriter, r *http.Request) error
- func (d *Dashboard) IsHealthy() bool
- func (d *Dashboard) RecordPrometheusBlocked(reason, category string)
- func (d *Dashboard) RecordPrometheusError(errorType string)
- func (d *Dashboard) RecordPrometheusProxyLatency(latency time.Duration)
- func (d *Dashboard) RecordPrometheusRequest(method, path string, status int, duration time.Duration)
- func (d *Dashboard) RecordPrometheusScanDuration(duration time.Duration)
- func (d *Dashboard) RecordPrometheusViolation(severity, category, pattern string)
- func (d *Dashboard) RegisterEventChannel(events <-chan metrics.MetricEvent)
- func (d *Dashboard) SetLocale(locale i18n.Locale) error
- func (d *Dashboard) Start() error
- func (d *Dashboard) StartMetricsSync(interval time.Duration)
- func (d *Dashboard) Stop(ctx context.Context) error
- type DashboardData
- type HandlerFunc
- type RateLimiter
- type Route
- type SecurityConfig
- type SecurityMiddleware
- type StatsFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type AdminHandler ¶
type AdminHandler struct {
// contains filtered or unexported fields
}
func NewAdminHandler ¶
func NewAdminHandler(authManager *auth.Manager, dashboard *Dashboard) *AdminHandler
func (*AdminHandler) RegisterRoutes ¶
func (ah *AdminHandler) RegisterRoutes()
type ComponentStatus ¶
type ComponentStatus struct {
Name string `json:"name"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
}
ComponentStatus represents the health status of a component
type Config ¶
type Config struct {
Port int `json:"port"`
StaticDir string `json:"static_dir"`
AuthToken string `json:"auth_token,omitempty"`
CORSEnabled bool `json:"cors_enabled"`
CORSOrigins []string `json:"cors_origins,omitempty"`
RateLimitRequests int `json:"rate_limit_requests"`
RateLimitBurst int `json:"rate_limit_burst"`
LogLevel string `json:"log_level"`
// Security configuration
EnableCSRF bool `json:"enable_csrf,omitempty"`
CSRFTokenLifetime time.Duration `json:"csrf_token_lifetime,omitempty"`
EnableAudit bool `json:"enable_audit,omitempty"`
AuditLevel string `json:"audit_level,omitempty"`
EnableSecurityHeaders bool `json:"enable_security_headers,omitempty"`
CSPPolicy string `json:"csp_policy,omitempty"`
EnablePanicRecovery bool `json:"enable_panic_recovery,omitempty"`
SecretsProvider string `json:"secrets_provider,omitempty"`
}
Config holds the dashboard configuration.
func DefaultConfig ¶
func DefaultConfig() Config
type Dashboard ¶
type Dashboard struct {
// contains filtered or unexported fields
}
func NewWithI18n ¶
NewWithI18n creates a new Dashboard with i18n support
func (*Dashboard) GetComponentStatus ¶
func (d *Dashboard) GetComponentStatus() []ComponentStatus
GetComponentStatus returns the current status of all components Useful for external monitoring systems
func (*Dashboard) GetI18nManager ¶
GetI18nManager returns the i18n manager for external access
func (*Dashboard) GetSystemMetrics ¶
GetSystemMetrics returns current system metrics
func (*Dashboard) HandleLocale ¶
HandleLocale handles GET /api/locale Returns current locale and supported locales
func (*Dashboard) HandleSetLocale ¶
HandleSetLocale handles POST /api/locale Sets the current locale
func (*Dashboard) RecordPrometheusBlocked ¶
RecordPrometheusBlocked records a blocked request to Prometheus metrics
func (*Dashboard) RecordPrometheusError ¶
RecordPrometheusError records an error to Prometheus metrics
func (*Dashboard) RecordPrometheusProxyLatency ¶
RecordPrometheusProxyLatency records proxy latency to Prometheus metrics
func (*Dashboard) RecordPrometheusRequest ¶
func (d *Dashboard) RecordPrometheusRequest(method, path string, status int, duration time.Duration)
RecordPrometheusRequest records a request to Prometheus metrics Called by the proxy when processing requests
func (*Dashboard) RecordPrometheusScanDuration ¶
RecordPrometheusScanDuration records WAF scan duration to Prometheus metrics
func (*Dashboard) RecordPrometheusViolation ¶
RecordPrometheusViolation records a violation to Prometheus metrics
func (*Dashboard) RegisterEventChannel ¶
func (d *Dashboard) RegisterEventChannel(events <-chan metrics.MetricEvent)
func (*Dashboard) StartMetricsSync ¶
StartMetricsSync starts a background goroutine that syncs internal metrics to Prometheus The sync interval determines how often the metrics are updated
type DashboardData ¶
type HandlerFunc ¶
type HandlerFunc func(w http.ResponseWriter, r *http.Request) error
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
func NewRateLimiter ¶
func NewRateLimiter(requests, burst int) *RateLimiter
func (*RateLimiter) Allow ¶
func (rl *RateLimiter) Allow(clientIP string) bool
type Route ¶
type Route struct {
Path string
Method string
Handler HandlerFunc
RequireAuth bool
RateLimited bool
}
type SecurityConfig ¶
type SecurityMiddleware ¶
type SecurityMiddleware struct {
// contains filtered or unexported fields
}
func NewSecurityMiddleware ¶
func NewSecurityMiddleware(config SecurityConfig) *SecurityMiddleware