From 2fba548bae5e4476d2675a4c23f0ab02cf2b8157 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Tue, 21 Apr 2026 07:29:23 -0400 Subject: [PATCH] Move type and const down to the bottom --- .../caddyhttp/reverseproxy/reverseproxy.go | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go index 6b5394cca..06aa2b101 100644 --- a/modules/caddyhttp/reverseproxy/reverseproxy.go +++ b/modules/caddyhttp/reverseproxy/reverseproxy.go @@ -266,29 +266,6 @@ type Handler struct { streamLogLoggerName string } -// StreamLogs controls logging for upgraded stream lifecycle events. -type StreamLogs struct { - // The minimum level at which stream lifecycle events are logged. - // Supported values are debug, info, warn, and error. Default: debug. - Level string `json:"level,omitempty"` - - // Logger name for stream lifecycle logs. Default: "http.handlers.reverse_proxy.stream". - // Special value "access" uses the access logger namespace and, if set, - // respects the first value in access_logger_names/log_name for the request. - LoggerName string `json:"logger_name,omitempty"` - - // If true, suppresses the access log entry normally emitted when an - // upgraded stream handshake completes and the request unwinds. - SkipHandshake bool `json:"skip_handshake,omitempty"` -} - -const ( - defaultStreamLogLevel = zapcore.DebugLevel - defaultStreamLoggerName = "http.handlers.reverse_proxy.stream" - streamLoggerNameUseAccess = "access" - defaultAccessLoggerBase = "http.log.access" -) - // CaddyModule returns the Caddy module information. func (Handler) CaddyModule() caddy.ModuleInfo { return caddy.ModuleInfo{ @@ -1813,6 +1790,22 @@ func (brc bodyReadCloser) Close() error { return nil } +// StreamLogs controls logging for upgraded stream lifecycle events. +type StreamLogs struct { + // The minimum level at which stream lifecycle events are logged. + // Supported values are debug, info, warn, and error. Default: debug. + Level string `json:"level,omitempty"` + + // Logger name for stream lifecycle logs. Default: "http.handlers.reverse_proxy.stream". + // Special value "access" uses the access logger namespace and, if set, + // respects the first value in access_logger_names/log_name for the request. + LoggerName string `json:"logger_name,omitempty"` + + // If true, suppresses the access log entry normally emitted when an + // upgraded stream handshake completes and the request unwinds. + SkipHandshake bool `json:"skip_handshake,omitempty"` +} + // bufPool is used for buffering requests and responses. var bufPool = sync.Pool{ New: func() any { @@ -1858,6 +1851,13 @@ const proxyHandleResponseContextCtxKey caddy.CtxKey = "reverse_proxy_handle_resp // errNoUpstream occurs when there are no upstream available. var errNoUpstream = fmt.Errorf("no upstreams available") +const ( + defaultStreamLogLevel = zapcore.DebugLevel + defaultStreamLoggerName = "http.handlers.reverse_proxy.stream" + streamLoggerNameUseAccess = "access" + defaultAccessLoggerBase = "http.log.access" +) + // Interface guards var ( _ caddy.Provisioner = (*Handler)(nil)