httpserver

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package httpserver builds the single gin.Engine every warden node serves its HTTP surface from (dashboard + /api/status + /metrics). The node-to-node cluster RPCs are served by the gRPC WardenService on the same port (see services/warden/grpcmux), not by this engine.

The engine configuration lives here, apart from cmd/main.go, so the package tests (dashboard, metrics) can exercise the *exact* production middleware, 405, and 404 behavior rather than a bare gin.New(). cmd/main.go's newRouter and every test build the router from NewEngine and then call the per-subsystem Register functions on it.

NewEngine is therefore the definition of warden's HTTP edge semantics, not a convenience: callers may rely on it returning an engine that has no routes of its own, answers an unknown path with 404 and a known path with the wrong method with 405, and performs no implicit redirects. Anything that changes those answers belongs here, where one change reaches production and every test at once.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEngine

func NewEngine() *gin.Engine

NewEngine returns a gin.Engine configured to match the semantics of the previous net/http ServeMux server:

  • gin.ReleaseMode + gin.New() (no gin request logger noise; a minimal panic-recovery middleware is installed below).
  • HandleMethodNotAllowed: a request to a known path with the wrong method yields 405 (with an Allow header) instead of 404, matching ServeMux.
  • Redirects disabled: no implicit trailing-slash or fixed-path redirects are introduced over the frozen wire contract; unmatched paths 404 outright.

Types

This section is empty.

Jump to

Keyboard shortcuts

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