middleware

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 14 Imported by: ? 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

Index

Constants

View Source
const (
	RedactedValue = "***REDACTED***"
)

Variables

This section is empty.

Functions

func OTelMiddleware

func OTelMiddleware(handler http.Handler) http.Handler

OTelMiddleware extracts W3C trace context and enriches logger context

Flow: 1. otelhttp.NewHandler creates/continues span from W3C headers 2. enrichedHandler extracts trace_id/span_id from span context 3. Adds trace identifiers to logger context for log correlation

Satisfies HyperFleet Logging Specification: "Components must extract trace context from W3C headers"

func SchemaValidationMiddleware

func SchemaValidationMiddleware(validator *validators.SchemaValidator) func(http.Handler) http.Handler

SchemaValidationMiddleware validates cluster and nodepool spec fields against OpenAPI schemas

Types

type MaskingMiddleware

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

MaskingMiddleware handles sensitive data masking for logging Masks sensitive HTTP headers and JSON body fields to prevent PII/secrets leakage

func NewMaskingMiddleware

func NewMaskingMiddleware(cfg *config.LoggingConfig) *MaskingMiddleware

NewMaskingMiddleware creates a new masking middleware from logging config

func (*MaskingMiddleware) MaskBody

func (m *MaskingMiddleware) MaskBody(body []byte) []byte

MaskBody masks sensitive fields in JSON body Handles both top-level objects and top-level arrays If masking is disabled, returns original body unchanged If masking is enabled but JSON parsing fails, applies text-based fallback masking

func (*MaskingMiddleware) MaskHeaders

func (m *MaskingMiddleware) MaskHeaders(headers http.Header) http.Header

Jump to

Keyboard shortcuts

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