web

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package web provides HTTP handlers for the trustwatch web UI and API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthzHandler

func HealthzHandler(getSnapshot SnapshotFunc, maxAge time.Duration) http.HandlerFunc

HealthzHandler returns 200 when a scan has completed within maxAge, 503 otherwise. A zero maxAge disables staleness checks (always healthy if any scan completed).

func HistoryHandler added in v0.2.0

func HistoryHandler(hs *history.Store) http.HandlerFunc

HistoryHandler returns the most recent snapshot summaries as JSON.

func ReadyzHandler added in v0.3.0

func ReadyzHandler(getSnapshot SnapshotFunc, maxAge time.Duration) http.HandlerFunc

ReadyzHandler returns JSON readiness detail. Returns 200 when scan is fresh, 503 when stale or no scan completed.

func SnapshotHandler

func SnapshotHandler(getSnapshot SnapshotFunc) http.HandlerFunc

SnapshotHandler returns the full snapshot as JSON. Accepts optional query params: ?source=, ?severity=, ?namespace= (comma-separated).

func TrendHandler added in v0.2.0

func TrendHandler(hs *history.Store) http.HandlerFunc

TrendHandler returns trend data points for a specific finding as JSON.

func UIHandler

func UIHandler(getSnapshot SnapshotFunc, opts ...func(*UIConfig)) http.HandlerFunc

UIHandler serves the problems web UI, filtering to critical+warn only.

func WithHistoryEnabled added in v0.2.0

func WithHistoryEnabled() func(*UIConfig)

WithHistoryEnabled marks that the /api/v1/trend endpoint is available.

Types

type SnapshotFunc

type SnapshotFunc func() store.Snapshot

SnapshotFunc returns the current snapshot.

type UIConfig added in v0.2.0

type UIConfig struct {
	// contains filtered or unexported fields
}

UIConfig holds options for UIHandler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL