# Packages
No description provided by the author
Package encode implements an encoder middleware for Caddy.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
CELMatcherDecorator matches a call overload generated by a CEL macro that takes a single argument, and optimizes the implementation to precompile the matcher and return a function that references the precompiled and provisioned matcher.
CELMatcherImpl creates a new cel.Library based on the following pieces of data:
- macroName: the function name to be used within CEL.
CELMatcherRuntimeFunction creates a function binding for when the input to the matcher is dynamically resolved rather than a set of static constant values.
CELValueToMapStrList converts a CEL value to a map[string][]string
Earlier validation stages should guarantee that the value has this type at compile time, and that the runtime value type is map[string]any.
CIDRExpressionToPrefix takes a string which could be either a CIDR expression or a single IP address, and returns a netip.Prefix.
CleanPath cleans path p according to path.Clean(), but only merges repeated slashes if collapseSlashes is true, and always preserves trailing slashes.
Error is a convenient way for a Handler to populate the essential fields of a HandlerError.
GetVar gets a value out of the context's variable table by key.
NewMatcherCELLibrary creates a matcherLibrary from option setes.
NewResponseRecorder returns a new ResponseRecorder that can be used instead of a standard http.ResponseWriter.
NewTestReplacer creates a replacer for an http.Request for use in tests that are not in this package.
ParseCaddyfileNestedMatcher parses the Caddyfile tokens for a nested matcher set, and returns its raw module map value.
ParseNamedResponseMatcher parses the tokens of a named response matcher.
PrepareRequest fills the request r for use in a Caddy HTTP handler chain.
PrivateRangesCIDR returns a list of private CIDR range strings, which can be used as a configuration shortcut.
RegisterNetworkHTTP3 registers a mapping from non-HTTP/3 network to HTTP/3 network.
SanitizedPathJoin performs filepath.Join(root, reqPath) that is safe against directory traversal attacks.
SetVar sets a value in the context's variable table with the given key.
StatusCodeMatches returns true if a real HTTP status code matches the configured status code, which may be either a real HTTP status code or an integer representing a class of codes (e.g.
# Constants
Variable name used to indicate the logger to be used.
The name of the CEL function which accesses Replacer values.
The name of the CEL request variable.
For tracking the real client IP (affected by trusted_proxy).
For referencing underlying net.Conn.
DefaultHTTPPort is the default port for HTTP.
DefaultHTTPSPort is the default port for HTTPS.
ErrorCtxKey is the context key to use when storing an error (for use with context.Context).
For adding additional fields to the access logs.
Variable name used to indicate that this request should be omitted from the access logs.
MatcherErrorVarKey is the key used for the variable that holds an optional error emitted from a request matcher, to short-circuit the handler chain, since matchers cannot return errors via the RequestMatcher interface.
No description provided by the author
For a partial copy of the unmodified request that originally came into the server's entry handler.
For referencing the server instance.
For tracking whether the client is a trusted proxy.
For the request's variable table.
# Variables
Variables used for replacing Caddy placeholders in CEL expressions with a proper CEL function call; this is just for syntactic sugar.
ErrNotImplemented is returned when an underlying ResponseWriter does not implement the required method.
# Structs
App is a robust, production-ready HTTP server.
AutoHTTPSConfig is used to disable automatic HTTPS or certain aspects of it for a specific server.
ExtraLogFields is a list of extra fields to log with every request.
HandlerError is a serializable representation of an error from within an HTTP handler.
HTTPErrorConfig determines how to handle errors from the HTTP handlers.
HTTPRedirectListenerWrapper provides HTTP->HTTPS redirects for connections that come on the TLS port as an HTTP request, by detecting using the first few bytes that it's not a TLS handshake, but instead an HTTP request.
Invoke implements a handler that compiles and executes a named route that was defined on the server.
LoggableHTTPHeader makes an HTTP header loggable with zap.Object().
LoggableHTTPRequest makes an HTTP request loggable with zap.Object().
MatchClientIP matches requests by the client IP address, i.e.
MatchExpression matches requests by evaluating a [CEL](https://github.com/google/cel-spec) expression.
No description provided by the author
No description provided by the author
MatchRegexp is an embedable type for matching using regular expressions.
MatchRemoteIP matches requests by the remote IP address, i.e.
No description provided by the author
Metrics configures metrics observations.
ResponseHandler pairs a response matcher with custom handling logic.
ResponseMatcher is a type which can determine if an HTTP response matches some criteria.
ResponseWriterWrapper wraps an underlying ResponseWriter and promotes its Pusher method as well.
Route consists of a set of rules for matching HTTP requests, a list of handlers to execute, and optional flow control parameters which customize the handling of HTTP requests in a highly flexible and performant manner.
Server describes an HTTP server.
ServerLogConfig describes a server's logging configuration.
StaticError implements a simple handler that returns an error.
StaticIPRange provides a static range of IP address prefixes (CIDRs).
StaticResponse implements a simple responder for static responses.
Subroute implements a handler that compiles and executes routes.
# Interfaces
CELLibraryProducer provide CEL libraries that expose a Matcher implementation as a first class function within the CEL expression matcher.
Handler is like http.Handler except ServeHTTP may return an error.
IPRangeSource gets a list of IP ranges.
MiddlewareHandler is like Handler except it takes as a third argument the next handler in the chain.
RequestMatcher is a type that can match to a request.
RequestMatcherWithError is like RequestMatcher but can return an error.
ResponseRecorder is a http.ResponseWriter that records responses instead of writing them to the client.
# Type aliases
CELMatcherFactory converts a constant CEL value into a RequestMatcher.
CELMatcherWithErrorFactory converts a constant CEL value into a RequestMatcherWithError.
HandlerFunc is a convenience type like http.HandlerFunc.
LoggableStringArray makes a slice of strings marshalable for logging.
LoggableTLSConnState makes a TLS connection state loggable with zap.Object().
MatcherSet is a set of matchers which must all match in order for the request to be matched successfully.
MatcherSets is a group of matcher sets capable of checking whether a request matches any of the sets.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
MatchVarsRE matches the value of the context variables by a given regular expression.
Middleware chains one Handler to the next by being passed the next Handler in the chain.
RawMatcherSets is a group of matcher sets in their raw, JSON form.
RouteList is a list of server routes that can create a middleware chain.
ShouldBufferFunc is a function that returns true if the response should be buffered, given the pending HTTP status code and response headers.
StringArray is a slices of strings, but also accepts a single string as a value when JSON unmarshaling, converting it to a slice of one string.
VarsMatcher is an HTTP request matcher which can match requests based on variables in the context or placeholder values.
VarsMiddleware is an HTTP middleware which sets variables to have values that can be used in the HTTP request handler chain.
WeakString is a type that unmarshals any JSON value as a string literal, with the following exceptions:
1.