Versions in this module Expand all Collapse all v2 v2.6.5 Jun 21, 2023 Changes in this version + const ClientIPVarKey + const ConnCtxKey + const DefaultHTTPPort + const DefaultHTTPSPort + const ErrorCtxKey + const ExtraLogFieldsCtxKey + const MatcherErrorVarKey + const OriginalRequestCtxKey + const ServerCtxKey + const SkipLogVar + const TrustedProxyVarKey + const VarsCtxKey + var CELTypeJSON = cel.MapType(cel.StringType, cel.DynType) + var ErrNotImplemented = fmt.Errorf("method not implemented") + func CELMatcherDecorator(funcName string, fac CELMatcherFactory) interpreter.InterpretableDecorator + func CELMatcherImpl(macroName, funcName string, matcherDataTypes []*cel.Type, ...) (cel.Library, error) + func CELMatcherRuntimeFunction(funcName string, fac CELMatcherFactory) functions.BinaryOp + func CELValueToMapStrList(data ref.Val) (map[string][]string, error) + func CIDRExpressionToPrefix(expr string) (netip.Prefix, error) + func CleanPath(p string, collapseSlashes bool) string + func GetVar(ctx context.Context, key string) any + func NewMatcherCELLibrary(envOptions []cel.EnvOption, programOptions []cel.ProgramOption) cel.Library + func NewTestReplacer(req *http.Request) *caddy.Replacer + func ParseCaddyfileNestedMatcherSet(d *caddyfile.Dispenser) (caddy.ModuleMap, error) + func ParseNamedResponseMatcher(d *caddyfile.Dispenser, matchers map[string]ResponseMatcher) error + func PrepareRequest(r *http.Request, repl *caddy.Replacer, w http.ResponseWriter, s *Server) *http.Request + func PrivateRangesCIDR() []string + func RegisterNetworkHTTP3(originalNetwork, h3Network string) + func SanitizedPathJoin(root, reqPath string) string + func SetVar(ctx context.Context, key string, value any) + func StatusCodeMatches(actual, configured int) bool + type App struct + GracePeriod caddy.Duration + HTTPPort int + HTTPSPort int + Servers map[string]*Server + ShutdownDelay caddy.Duration + func (App) CaddyModule() caddy.ModuleInfo + func (app *App) Provision(ctx caddy.Context) error + func (app *App) Start() error + func (app *App) Stop() error + func (app *App) Validate() error + type AutoHTTPSConfig struct + DisableCerts bool + DisableRedir bool + Disabled bool + IgnoreLoadedCerts bool + Skip []string + SkipCerts []string + func (ahc AutoHTTPSConfig) Skipped(name string, skipSlice []string) bool + type CELLibraryProducer interface + CELLibrary func(caddy.Context) (cel.Library, error) + type CELMatcherFactory func(data ref.Val) (RequestMatcher, error) + type ExtraLogFields struct + func (e *ExtraLogFields) Add(field zap.Field) + type HTTPErrorConfig struct + Routes RouteList + func (*HTTPErrorConfig) WithError(r *http.Request, err error) *http.Request + type HTTPInterfaces interface + type HTTPRedirectListenerWrapper struct + func (HTTPRedirectListenerWrapper) CaddyModule() caddy.ModuleInfo + func (h *HTTPRedirectListenerWrapper) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (h *HTTPRedirectListenerWrapper) WrapListener(l net.Listener) net.Listener + type Handler interface + ServeHTTP func(http.ResponseWriter, *http.Request) error + type HandlerError struct + Err error + ID string + StatusCode int + Trace string + func Error(statusCode int, err error) HandlerError + func (e HandlerError) Error() string + func (e HandlerError) Unwrap() error + type HandlerFunc func(http.ResponseWriter, *http.Request) error + func (f HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) error + type IPRangeSource interface + GetIPRanges func(*http.Request) []netip.Prefix + type Invoke struct + Name string + func (Invoke) CaddyModule() caddy.ModuleInfo + func (invoke *Invoke) ServeHTTP(w http.ResponseWriter, r *http.Request, next Handler) error + type LoggableHTTPHeader struct + ShouldLogCredentials bool + func (h LoggableHTTPHeader) MarshalLogObject(enc zapcore.ObjectEncoder) error + type LoggableHTTPRequest struct + ShouldLogCredentials bool + func (r LoggableHTTPRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error + type LoggableStringArray []string + func (sa LoggableStringArray) MarshalLogArray(enc zapcore.ArrayEncoder) error + type LoggableTLSConnState tls.ConnectionState + func (t LoggableTLSConnState) MarshalLogObject(enc zapcore.ObjectEncoder) error + type MatchClientIP struct + Ranges []string + func (MatchClientIP) CELLibrary(ctx caddy.Context) (cel.Library, error) + func (MatchClientIP) CaddyModule() caddy.ModuleInfo + func (m *MatchClientIP) Provision(ctx caddy.Context) error + func (m *MatchClientIP) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchClientIP) Match(r *http.Request) bool + type MatchExpression struct + Expr string + func (MatchExpression) CaddyModule() caddy.ModuleInfo + func (m *MatchExpression) Provision(ctx caddy.Context) error + func (m *MatchExpression) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m *MatchExpression) UnmarshalJSON(data []byte) error + func (m MatchExpression) MarshalJSON() ([]byte, error) + func (m MatchExpression) Match(r *http.Request) bool + type MatchHeader http.Header + func (MatchHeader) CELLibrary(_ caddy.Context) (cel.Library, error) + func (MatchHeader) CaddyModule() caddy.ModuleInfo + func (m *MatchHeader) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchHeader) Match(r *http.Request) bool + type MatchHeaderRE map[string]*MatchRegexp + func (MatchHeaderRE) CELLibrary(ctx caddy.Context) (cel.Library, error) + func (MatchHeaderRE) CaddyModule() caddy.ModuleInfo + func (m *MatchHeaderRE) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchHeaderRE) Match(r *http.Request) bool + func (m MatchHeaderRE) Provision(ctx caddy.Context) error + func (m MatchHeaderRE) Validate() error + type MatchHost []string + func (MatchHost) CELLibrary(ctx caddy.Context) (cel.Library, error) + func (MatchHost) CaddyModule() caddy.ModuleInfo + func (m *MatchHost) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchHost) Match(r *http.Request) bool + func (m MatchHost) Provision(_ caddy.Context) error + type MatchMethod []string + func (MatchMethod) CELLibrary(_ caddy.Context) (cel.Library, error) + func (MatchMethod) CaddyModule() caddy.ModuleInfo + func (m *MatchMethod) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchMethod) Match(r *http.Request) bool + type MatchNot struct + MatcherSets []MatcherSet + MatcherSetsRaw []caddy.ModuleMap + func (MatchNot) CaddyModule() caddy.ModuleInfo + func (m *MatchNot) Provision(ctx caddy.Context) error + func (m *MatchNot) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m *MatchNot) UnmarshalJSON(data []byte) error + func (m MatchNot) MarshalJSON() ([]byte, error) + func (m MatchNot) Match(r *http.Request) bool + type MatchPath []string + func (MatchPath) CELLibrary(ctx caddy.Context) (cel.Library, error) + func (MatchPath) CaddyModule() caddy.ModuleInfo + func (m *MatchPath) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchPath) Match(r *http.Request) bool + func (m MatchPath) Provision(_ caddy.Context) error + type MatchPathRE struct + func (MatchPathRE) CELLibrary(ctx caddy.Context) (cel.Library, error) + func (MatchPathRE) CaddyModule() caddy.ModuleInfo + func (m MatchPathRE) Match(r *http.Request) bool + type MatchProtocol string + func (MatchProtocol) CELLibrary(_ caddy.Context) (cel.Library, error) + func (MatchProtocol) CaddyModule() caddy.ModuleInfo + func (m *MatchProtocol) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchProtocol) Match(r *http.Request) bool + type MatchQuery url.Values + func (MatchQuery) CELLibrary(_ caddy.Context) (cel.Library, error) + func (MatchQuery) CaddyModule() caddy.ModuleInfo + func (m *MatchQuery) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchQuery) Match(r *http.Request) bool + type MatchRegexp struct + Name string + Pattern string + func (mre *MatchRegexp) Match(input string, repl *caddy.Replacer) bool + func (mre *MatchRegexp) Provision(caddy.Context) error + func (mre *MatchRegexp) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (mre *MatchRegexp) Validate() error + type MatchRemoteIP struct + Forwarded bool + Ranges []string + func (MatchRemoteIP) CELLibrary(ctx caddy.Context) (cel.Library, error) + func (MatchRemoteIP) CaddyModule() caddy.ModuleInfo + func (m *MatchRemoteIP) Provision(ctx caddy.Context) error + func (m *MatchRemoteIP) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchRemoteIP) Match(r *http.Request) bool + type MatchVarsRE map[string]*MatchRegexp + func (MatchVarsRE) CaddyModule() caddy.ModuleInfo + func (m *MatchVarsRE) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchVarsRE) Match(r *http.Request) bool + func (m MatchVarsRE) Provision(ctx caddy.Context) error + func (m MatchVarsRE) Validate() error + type MatcherSet []RequestMatcher + func (mset MatcherSet) Match(r *http.Request) bool + type MatcherSets []MatcherSet + func (ms *MatcherSets) FromInterface(matcherSets any) error + func (ms MatcherSets) AnyMatch(req *http.Request) bool + func (ms MatcherSets) String() string + type Metrics struct + type Middleware func(Handler) Handler + type MiddlewareHandler interface + ServeHTTP func(http.ResponseWriter, *http.Request, Handler) error + type RawMatcherSets []caddy.ModuleMap + type RequestMatcher interface + Match func(*http.Request) bool + type ResponseHandler struct + Match *ResponseMatcher + Routes RouteList + StatusCode WeakString + func (rh *ResponseHandler) Provision(ctx caddy.Context) error + type ResponseMatcher struct + Headers http.Header + StatusCode []int + func (rm ResponseMatcher) Match(statusCode int, hdr http.Header) bool + type ResponseRecorder interface + Buffer func() *bytes.Buffer + Buffered func() bool + Size func() int + Status func() int + WriteResponse func() error + func NewResponseRecorder(w http.ResponseWriter, buf *bytes.Buffer, shouldBuffer ShouldBufferFunc) ResponseRecorder + type ResponseWriterWrapper struct + func (rww *ResponseWriterWrapper) Flush() + func (rww *ResponseWriterWrapper) Hijack() (net.Conn, *bufio.ReadWriter, error) + func (rww *ResponseWriterWrapper) Push(target string, opts *http.PushOptions) error + func (rww *ResponseWriterWrapper) ReadFrom(r io.Reader) (n int64, err error) + func (rww *ResponseWriterWrapper) Unwrap() http.ResponseWriter + type Route struct + Group string + Handlers []MiddlewareHandler + HandlersRaw []json.RawMessage + MatcherSets MatcherSets + MatcherSetsRaw RawMatcherSets + Terminal bool + func (r *Route) Provision(ctx caddy.Context, metrics *Metrics) error + func (r *Route) ProvisionHandlers(ctx caddy.Context, metrics *Metrics) error + func (r *Route) ProvisionMatchers(ctx caddy.Context) error + func (r Route) Compile(next Handler) Handler + func (r Route) Empty() bool + func (r Route) String() string + type RouteList []Route + func (routes RouteList) Compile(next Handler) Handler + func (routes RouteList) Provision(ctx caddy.Context) error + func (routes RouteList) ProvisionHandlers(ctx caddy.Context, metrics *Metrics) error + func (routes RouteList) ProvisionMatchers(ctx caddy.Context) error + type Server struct + AutoHTTPS *AutoHTTPSConfig + ClientIPHeaders []string + Errors *HTTPErrorConfig + IdleTimeout caddy.Duration + KeepAliveInterval caddy.Duration + Listen []string + ListenerWrappersRaw []json.RawMessage + Logs *ServerLogConfig + MaxHeaderBytes int + Metrics *Metrics + NamedRoutes map[string]*Route + Protocols []string + ReadHeaderTimeout caddy.Duration + ReadTimeout caddy.Duration + Routes RouteList + StrictSNIHost *bool + TLSConnPolicies caddytls.ConnectionPolicies + TrustedProxiesRaw json.RawMessage + WriteTimeout caddy.Duration + func (s *Server) Listeners() []net.Listener + func (s *Server) Name() string + func (s *Server) RegisterConnContext(f func(ctx context.Context, c net.Conn) context.Context) + func (s *Server) RegisterConnState(f func(net.Conn, http.ConnState)) + func (s *Server) RegisterOnShutdown(f func()) + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + type ServerLogConfig struct + DefaultLoggerName string + LoggerNames map[string]string + ShouldLogCredentials bool + SkipHosts []string + SkipUnmappedHosts bool + type ShouldBufferFunc func(status int, header http.Header) bool + type StaticError struct + Error string + StatusCode WeakString + func (StaticError) CaddyModule() caddy.ModuleInfo + func (e *StaticError) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (e StaticError) ServeHTTP(w http.ResponseWriter, r *http.Request, _ Handler) error + type StaticIPRange struct + Ranges []string + func (StaticIPRange) CaddyModule() caddy.ModuleInfo + func (m *StaticIPRange) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (s *StaticIPRange) GetIPRanges(_ *http.Request) []netip.Prefix + func (s *StaticIPRange) Provision(ctx caddy.Context) error + type StaticResponse struct + Abort bool + Body string + Close bool + Headers http.Header + StatusCode WeakString + func (StaticResponse) CaddyModule() caddy.ModuleInfo + func (s *StaticResponse) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (s StaticResponse) ServeHTTP(w http.ResponseWriter, r *http.Request, next Handler) error + type Subroute struct + Errors *HTTPErrorConfig + Routes RouteList + func (Subroute) CaddyModule() caddy.ModuleInfo + func (sr *Subroute) Provision(ctx caddy.Context) error + func (sr *Subroute) ServeHTTP(w http.ResponseWriter, r *http.Request, next Handler) error + type VarsMatcher map[string][]string + func (VarsMatcher) CaddyModule() caddy.ModuleInfo + func (m *VarsMatcher) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m VarsMatcher) Match(r *http.Request) bool + type VarsMiddleware map[string]any + func (VarsMiddleware) CaddyModule() caddy.ModuleInfo + func (m *VarsMiddleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m VarsMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next Handler) error + type WeakString string + func (ws *WeakString) UnmarshalJSON(b []byte) error + func (ws WeakString) Bool() bool + func (ws WeakString) Float64() float64 + func (ws WeakString) Int() int + func (ws WeakString) MarshalJSON() ([]byte, error) + func (ws WeakString) String() string