api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package api serves the alert feed, asset inventory, and live dashboard.

The dashboard is embedded in the binary with go:embed rather than built by a JavaScript toolchain and served from disk. That is a deliberate constraint: the point of this project is a single static binary with no runtime dependencies, and a UI that needs `npm install` before it will start would undo that for the sake of a framework nobody looking at a network sensor cares about.

Index

Constants

View Source
const DefaultMaxAlerts = 5000

DefaultMaxAlerts bounds the in-memory alert ring.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server exposes the sensor's state over HTTP.

func New

func New(pipe *pipeline.Pipeline, eng *detect.Engine, inv *detect.Inventory, maxAlerts int) *Server

New returns a server backed by a running pipeline.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler builds the HTTP routes.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context, addr string) error

ListenAndServe runs the server until ctx is cancelled.

func (*Server) Publish

func (s *Server) Publish(a model.Alert)

Publish records an alert and fans it out to live subscribers. It is safe to call from the pipeline goroutine and never blocks on a slow HTTP client.

Jump to

Keyboard shortcuts

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