httpd

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package httpd is the HTTP server under a tool's routes: it listens, answers a health check, and on stop lets requests under way finish. An MCP server and a metrics page each serve through it.

Index

Constants

View Source
const (
	// HealthPath answers "ok" while the tool is serving, whatever state the thing it works on is in: a container is not unhealthy because what it
	// watches is down.
	HealthPath = "/healthz"
)

Variables

This section is empty.

Functions

func Health

func Health(mux *http.ServeMux)

Health adds the health check to mux at HealthPath.

func Listen

func Listen(ctx context.Context, addr string) (net.Listener, error)

Listen takes the address to serve on, ":8080" say, before anything is served, so a tool can say where it is serving: a port of 0 is one picked for it. An address that cannot be listened on is an error naming it.

func Serve

func Serve(ctx context.Context, ln net.Listener, h http.Handler, onStop ...func()) error

Serve serves h on ln until the context ends, then gives requests under way ten seconds to finish. Each onStop runs as the stop begins: an MCP server closes its sessions there, which would otherwise hold the stop open. Whoever calls it ends the context on a signal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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