server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package server is the HTTP composition root for the serve command: it builds the root mux, wraps it in compression and the access log, and mounts the route sets that live in their own packages — the JSON API (internal/api) under /api/, and the HTML web UI (internal/web, serving its own /static/ assets) at /, both behind the web UI's login gate. The health endpoints are its own, since serving lifecycle is not a web or API concern.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server holds the dependencies shared by every mounted route set.

func New

func New(
	db *store.Store, cfg *config.Config, addr, cfgPath string,
	ing *ingest.Manager, log zerolog.Logger,
) *Server

New returns a Server backed by db, using cfg for request defaults. addr is the bound listen address, forwarded to the web UI for display only. cfgPath is the loaded config's path, shown read-only by the web UI's config viewer. ing owns the in-process ingest runs the web UI triggers. log backs the access log.

func (*Server) Dev added in v0.2.0

func (s *Server) Dev(on bool)

Dev serves the embedded assets no-cache, so an edited stylesheet or script shows on the next reload instead of after the normal cache window.

func (*Server) Drain

func (s *Server) Drain()

Drain flips readiness to 503 before the HTTP server stops accepting, giving a proxy or orchestrator a window to route away while in-flight requests finish.

func (*Server) Routes

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

Routes builds the root handler. The API sub-mux keeps its full /api/ patterns, so mounting it under "/api/" (no StripPrefix) lets its method+path patterns match unchanged.

func (*Server) TrustProxies added in v0.2.0

func (s *Server) TrustProxies(nets []netip.Prefix)

TrustProxies sets the networks whose forwarding headers the login gate believes, in place of its loopback default. Empty trusts none.

Jump to

Keyboard shortcuts

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