httputils

package
v0.0.0-...-943d3da Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CrowdSecActionVar     = "crowdsec.action"
	CrowdSecValueVar      = "crowdsec.value"
	CrowdSecDurationVar   = "crowdsec.duration"
	CrowdSecStatusVar     = "crowdsec.status_code"
	CrowdSecRetryAfterVar = "crowdsec.retry_after"
)

Variables

This section is empty.

Functions

func DecisionError

func DecisionError(ctx context.Context, typ, value, duration string, statusCode int) error

DecisionError converts a CrowdSec decision to a Caddy HTTP error so request handling can be delegated to handle_errors routes.

func EnsureIP

func EnsureIP(ctx context.Context) (context.Context, netip.Addr)

func FromContext

func FromContext(ctx context.Context) (netip.Addr, bool)

func WriteResponse

func WriteResponse(w http.ResponseWriter, logger *zap.Logger, typ, value, duration string, statusCode int) error

WriteResponse writes a response to the http.ResponseWriter based on the typ, value, duration and status code provide.

Types

This section is empty.