httpcheck

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 16 Imported by: 1 module, 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 httpcheck implements POST /v1/check, the engine's own check API (api/engine/v1). It serves proxies without a native protocol (the ingress-nginx Lua plugin, the Traefik plugin), inkwallctl and tests.

The caller describes one client request in a CheckRequest, protobuf (Content-Type: application/x-protobuf) or JSON (application/json), and gets the verdict back in a CheckResponse in the same encoding. Any well-formed check is answered with 200; the verdict is in the body.

The caller is trusted: the engine inspects the request it describes and takes its client_ip as given. Listen only where the proxy alone can reach it (a Unix socket or localhost).

Index

Constants

View Source
const (
	ContentTypeProtobuf = "application/x-protobuf"
	ContentTypeJSON     = "application/json"
)

Content types of the two encodings.

View Source
const Path = "/v1/check"

Path is where check requests are sent.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// MaxBodyBytes is how much of a request body is inspected; longer bodies
	// are treated as truncated. Zero disables body inspection.
	MaxBodyBytes int64
	// Logger receives one security event per denied or logged request.
	// Nil uses slog.Default().
	Logger *slog.Logger
	// Events records each security event for the operator (nil: logged
	// only).
	Events *events.Recorder
}

Config configures a Handler.

type Handler

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

Handler answers check requests.

func New

func New(p pipeline.Inspector, cfg Config) (*Handler, error)

New returns a Handler that inspects requests with p.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP decodes a CheckRequest, inspects the request it describes and writes the CheckResponse.

Jump to

Keyboard shortcuts

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