server

package
v0.3.0-rc.53 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 10 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 routes the service's HTTP requests: health and readiness, metrics (direct connections only), Feishu's HTTP callbacks, the drill check, the REST API, the MCP endpoint and the pages (the public ones at the root, the console under /console). Machines (probes, the rule engine) use the gateway's own listener.

Index

Constants

View Source
const CSP = "default-src 'none'; style-src 'self'; img-src 'self' data:; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"

CSP for everything the service serves itself; the pages bring their own.

Variables

This section is empty.

Functions

func Handler

func Handler(d Deps) http.Handler

Handler builds the router.

Types

type Deps

type Deps struct {
	Bridge   *bridge.Bridge
	API      *api.Server
	MCP      http.Handler
	Metrics  http.Handler
	Feishu   http.Handler
	DrillRun func() exercise.Run
	Exercise *exercise.Authority
	Log      *slog.Logger
	Web      *web.Server
	// Standby, when set (a primary/standby pair's lease was not held at the last attempt), turns
	// /healthz to 503: the load balancer or the VIP in front sends its traffic to the primary.
	Standby func() bool
	// Live, when set, is the instance's own health (it can reach PostgreSQL), including a waiting
	// standby. Docker's health check asks /livez so it does not restart a healthy standby.
	// Nil treats the process as live.
	Live func() bool
	// OAuth is Beacon's authorization server for MCP clients: its metadata, registration, token and
	// revocation endpoints (the console serves /oauth/authorize); nil leaves them out.
	OAuth *oauth.Server
}

Deps are what the routes need. Feishu is nil unless callbacks come over HTTP; Web nil serves only the public page at / (without status pages, the console or the pages people open from the chat).

Jump to

Keyboard shortcuts

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