| 1 | // Copyright 2015 Matthew Holt and The Caddy Authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package reverseproxyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/ |
| 16 | |
| 17 | import ( |
| 18 | "contextscip-go gomod github.com/golang/go/src go1.25.1 context/" |
| 19 | "fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/" |
| 20 | "net/netipscip-go gomod github.com/golang/go/src go1.25.1 `net/netip`/" |
| 21 | "strconvscip-go gomod github.com/golang/go/src go1.25.1 strconv/" |
| 22 | "syncscip-go gomod github.com/golang/go/src go1.25.1 sync/" |
| 23 | "sync/atomicscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/" |
| 24 | "timescip-go gomod github.com/golang/go/src go1.25.1 time/" |
| 25 | |
| 26 | "github.com/caddyserver/caddy/v2scip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/" |
| 27 | "github.com/caddyserver/caddy/v2/modules/caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/" |
| 28 | ) |
| 29 | |
| 30 | // UpstreamPool is a collection of upstreams. |
| 31 | type UpstreamPoolscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/UpstreamPool# []*Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream# |
| 32 | |
| 33 | // Upstream bridges this proxy's configuration to the |
| 34 | // state of the backend host it is correlated with. |
| 35 | // Upstream values must not be copied. |
| 36 | type Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream# struct { |
| 37 | *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Host. `json:"-"` |
| 38 | |
| 39 | // The [network address](/docs/conventions#network-addresses) |
| 40 | // to dial to connect to the upstream. Must represent precisely |
| 41 | // one socket (i.e. no port ranges). A valid network address |
| 42 | // either has a host and port or is a unix socket address. |
| 43 | // |
| 44 | // Placeholders may be used to make the upstream dynamic, but be |
| 45 | // aware of the health check implications of this: a single |
| 46 | // upstream that represents numerous (perhaps arbitrary) backends |
| 47 | // can be considered down if one or enough of the arbitrary |
| 48 | // backends is down. Also be aware of open proxy vulnerabilities. |
| 49 | Dialscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Dial. string `json:"dial,omitempty"` |
| 50 | |
| 51 | // The maximum number of simultaneous requests to allow to |
| 52 | // this upstream. If set, overrides the global passive health |
| 53 | // check UnhealthyRequestCount value. |
| 54 | MaxRequestsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#MaxRequests. int `json:"max_requests,omitempty"` |
| 55 | |
| 56 | // TODO: This could be really useful, to bind requests |
| 57 | // with certain properties to specific backends |
| 58 | // HeaderAffinity string |
| 59 | // IPAffinity string |
| 60 | |
| 61 | activeHealthCheckPortscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#activeHealthCheckPort. int |
| 62 | activeHealthCheckUpstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#activeHealthCheckUpstream. string |
| 63 | healthCheckPolicyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#healthCheckPolicy. *PassiveHealthChecksscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/PassiveHealthChecks# |
| 64 | cbscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#cb. CircuitBreakerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/CircuitBreaker# |
| 65 | unhealthyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#unhealthy. atomicscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/.Int32scip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int32# // status from active health checker |
| 66 | } |
| 67 | |
| 68 | // (pointer receiver necessary to avoid a race condition, since |
| 69 | // copying the Upstream reads the 'unhealthy' field which is |
| 70 | // accessed atomically) |
| 71 | func (u *Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#) Stringscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#String().() string { return u.Dialscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Dial. } |
| 72 | |
| 73 | // Available returns true if the remote host |
| 74 | // is available to receive requests. This is |
| 75 | // the method that should be used by selection |
| 76 | // policies, etc. to determine if a backend |
| 77 | // should be able to be sent a request. |
| 78 | func (u *Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#) Availablescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Available().() bool { |
| 79 | return u.Healthyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Healthy().() && !u.Fullscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Full().() |
| 80 | } |
| 81 | |
| 82 | // Healthy returns true if the remote host |
| 83 | // is currently known to be healthy or "up". |
| 84 | // It consults the circuit breaker, if any. |
| 85 | func (u *Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#) Healthyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Healthy().() bool { |
| 86 | healthy := u.healthyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#healthy().() |
| 87 | if healthy && u.healthCheckPolicyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#healthCheckPolicy. != nil { |
| 88 | healthy = u.Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Host..Failsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#Fails().() < u.healthCheckPolicyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#healthCheckPolicy..MaxFailsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/PassiveHealthChecks#MaxFails. |
| 89 | } |
| 90 | if healthy && u.cbscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#cb. != nil { |
| 91 | healthy = u.cbscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#cb..OKscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/CircuitBreaker#OK.() |
| 92 | } |
| 93 | return healthy |
| 94 | } |
| 95 | |
| 96 | // Full returns true if the remote host |
| 97 | // cannot receive more requests at this time. |
| 98 | func (u *Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#) Fullscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Full().() bool { |
| 99 | return u.MaxRequestsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#MaxRequests. > 0 && u.Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Host..NumRequestsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#NumRequests().() >= u.MaxRequestsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#MaxRequests. |
| 100 | } |
| 101 | |
| 102 | // fillDialInfo returns a filled DialInfo for upstream u, using the request |
| 103 | // context. Note that the returned value is not a pointer. |
| 104 | func (u *Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#) fillDialInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#fillDialInfo().(repl *caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Replacerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#) (DialInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#, error) { |
| 105 | var addr caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.NetworkAddressscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/NetworkAddress# |
| 106 | |
| 107 | // use provided dial address |
| 108 | var err error |
| 109 | dial := repl.ReplaceAllscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceAll().(u.Dialscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Dial., "") |
| 110 | addr, err = caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ParseNetworkAddressscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ParseNetworkAddress().(dial) |
| 111 | if err != nil { |
| 112 | return DialInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#{}, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("upstream %s: invalid dial address %s: %v", u.Dialscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Dial., dial, err) |
| 113 | } |
| 114 | if numPorts := addr.PortRangeSizescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/NetworkAddress#PortRangeSize().(); numPorts != 1 { |
| 115 | return DialInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#{}, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("upstream %s: dial address must represent precisely one socket: %s represents %d", |
| 116 | u.Dialscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Dial., dial, numPorts) |
| 117 | } |
| 118 | |
| 119 | return DialInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#{ |
| 120 | Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Upstream.: u, |
| 121 | Networkscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Network.: addr.Networkscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/NetworkAddress#Network., |
| 122 | Addressscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Address.: addr.JoinHostPortscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/NetworkAddress#JoinHostPort().(0), |
| 123 | Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Host.: addr.Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/NetworkAddress#Host., |
| 124 | Portscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Port.: strconvscip-go gomod github.com/golang/go/src go1.25.1 strconv/.Itoascip-go gomod github.com/golang/go/src go1.25.1 strconv/Itoa().(int(addr.StartPortscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/NetworkAddress#StartPort.)), |
| 125 | }, nil |
| 126 | } |
| 127 | |
| 128 | func (u *Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#) fillHostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#fillHost().() { |
| 129 | host := new(Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) |
| 130 | existingHost, loaded := hostsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/hosts..LoadOrStorescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/UsagePool#LoadOrStore().(u.Stringscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#String().(), host) |
| 131 | if loaded { |
| 132 | host = existingHost.(*Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) |
| 133 | } |
| 134 | u.Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Host. = host |
| 135 | } |
| 136 | |
| 137 | // fillDynamicHost is like fillHost, but stores the host in the separate |
| 138 | // dynamicHosts map rather than the reference-counted UsagePool. Dynamic |
| 139 | // hosts are not reference-counted; instead, they are retained as long as |
| 140 | // they are actively seen and are evicted by a background cleanup goroutine |
| 141 | // after dynamicHostIdleExpiry of inactivity. This preserves health state |
| 142 | // (e.g. passive fail counts) across sequential requests. |
| 143 | func (u *Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#) fillDynamicHostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#fillDynamicHost().() { |
| 144 | dynamicHostsMuscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostsMu..Lockscip-go gomod github.com/golang/go/src go1.25.1 sync/RWMutex#Lock().() |
| 145 | entry, ok := dynamicHostsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHosts.[u.Stringscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#String().()] |
| 146 | if ok { |
| 147 | entry.lastSeenscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostEntry#lastSeen. = timescip-go gomod github.com/golang/go/src go1.25.1 time/.Nowscip-go gomod github.com/golang/go/src go1.25.1 time/Now().() |
| 148 | dynamicHostsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHosts.[u.Stringscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#String().()] = entry |
| 149 | u.Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Host. = entry.hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostEntry#host. |
| 150 | } else { |
| 151 | h := new(Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) |
| 152 | dynamicHostsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHosts.[u.Stringscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#String().()] = dynamicHostEntryscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostEntry#{hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostEntry#host.: h, lastSeenscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostEntry#lastSeen.: timescip-go gomod github.com/golang/go/src go1.25.1 time/.Nowscip-go gomod github.com/golang/go/src go1.25.1 time/Now().()} |
| 153 | u.Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#Host. = h |
| 154 | } |
| 155 | dynamicHostsMuscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostsMu..Unlockscip-go gomod github.com/golang/go/src go1.25.1 sync/RWMutex#Unlock().() |
| 156 | |
| 157 | // ensure the cleanup goroutine is running |
| 158 | dynamicHostsCleanerOncescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostsCleanerOnce..Doscip-go gomod github.com/golang/go/src go1.25.1 sync/Once#Do().(func() { |
| 159 | go func() { |
| 160 | for { |
| 161 | timescip-go gomod github.com/golang/go/src go1.25.1 time/.Sleepscip-go gomod github.com/golang/go/src go1.25.1 time/Sleep().(dynamicHostCleanupIntervalscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostCleanupInterval.) |
| 162 | dynamicHostsMuscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostsMu..Lockscip-go gomod github.com/golang/go/src go1.25.1 sync/RWMutex#Lock().() |
| 163 | for addr, entry := range dynamicHostsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHosts. { |
| 164 | if timescip-go gomod github.com/golang/go/src go1.25.1 time/.Sincescip-go gomod github.com/golang/go/src go1.25.1 time/Since().(entry.lastSeenscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostEntry#lastSeen.) > dynamicHostIdleExpiryscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostIdleExpiry. { |
| 165 | delete(dynamicHostsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHosts., addr) |
| 166 | } |
| 167 | } |
| 168 | dynamicHostsMuscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostsMu..Unlockscip-go gomod github.com/golang/go/src go1.25.1 sync/RWMutex#Unlock().() |
| 169 | } |
| 170 | }() |
| 171 | }) |
| 172 | } |
| 173 | |
| 174 | // Host is the basic, in-memory representation of the state of a remote host. |
| 175 | // Its fields are accessed atomically and Host values must not be copied. |
| 176 | type Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host# struct { |
| 177 | numRequestsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#numRequests. atomicscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/.Int64scip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64# |
| 178 | failsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#fails. atomicscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/.Int64scip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64# |
| 179 | activePassesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#activePasses. atomicscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/.Int64scip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64# |
| 180 | activeFailsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#activeFails. atomicscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/.Int64scip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64# |
| 181 | } |
| 182 | |
| 183 | // NumRequests returns the number of active requests to the upstream. |
| 184 | func (h *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) NumRequestsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#NumRequests().() int { |
| 185 | return int(h.numRequestsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#numRequests..Loadscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64#Load().()) |
| 186 | } |
| 187 | |
| 188 | // Fails returns the number of recent failures with the upstream. |
| 189 | func (h *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) Failsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#Fails().() int { |
| 190 | return int(h.failsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#fails..Loadscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64#Load().()) |
| 191 | } |
| 192 | |
| 193 | // activeHealthPasses returns the number of consecutive active health check passes with the upstream. |
| 194 | func (h *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) activeHealthPassesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#activeHealthPasses().() int { |
| 195 | return int(h.activePassesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#activePasses..Loadscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64#Load().()) |
| 196 | } |
| 197 | |
| 198 | // activeHealthFails returns the number of consecutive active health check failures with the upstream. |
| 199 | func (h *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) activeHealthFailsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#activeHealthFails().() int { |
| 200 | return int(h.activeFailsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#activeFails..Loadscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64#Load().()) |
| 201 | } |
| 202 | |
| 203 | // countRequest mutates the active request count by |
| 204 | // delta. It returns an error if the adjustment fails. |
| 205 | func (h *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) countRequestscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#countRequest().(delta int) error { |
| 206 | result := h.numRequestsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#numRequests..Addscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64#Add().(int64(delta)) |
| 207 | if result < 0 { |
| 208 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("count below 0: %d", result) |
| 209 | } |
| 210 | return nil |
| 211 | } |
| 212 | |
| 213 | // countFail mutates the recent failures count by |
| 214 | // delta. It returns an error if the adjustment fails. |
| 215 | func (h *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) countFailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#countFail().(delta int) error { |
| 216 | result := h.failsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#fails..Addscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64#Add().(int64(delta)) |
| 217 | if result < 0 { |
| 218 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("count below 0: %d", result) |
| 219 | } |
| 220 | return nil |
| 221 | } |
| 222 | |
| 223 | // countHealthPass mutates the recent passes count by |
| 224 | // delta. It returns an error if the adjustment fails. |
| 225 | func (h *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) countHealthPassscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#countHealthPass().(delta int) error { |
| 226 | result := h.activePassesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#activePasses..Addscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64#Add().(int64(delta)) |
| 227 | if result < 0 { |
| 228 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("count below 0: %d", result) |
| 229 | } |
| 230 | return nil |
| 231 | } |
| 232 | |
| 233 | // countHealthFail mutates the recent failures count by |
| 234 | // delta. It returns an error if the adjustment fails. |
| 235 | func (h *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) countHealthFailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#countHealthFail().(delta int) error { |
| 236 | result := h.activeFailsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#activeFails..Addscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64#Add().(int64(delta)) |
| 237 | if result < 0 { |
| 238 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("count below 0: %d", result) |
| 239 | } |
| 240 | return nil |
| 241 | } |
| 242 | |
| 243 | // resetHealth resets the health check counters. |
| 244 | func (h *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#) resetHealthscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#resetHealth().() { |
| 245 | h.activePassesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#activePasses..Storescip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64#Store().(0) |
| 246 | h.activeFailsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host#activeFails..Storescip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int64#Store().(0) |
| 247 | } |
| 248 | |
| 249 | // healthy returns true if the upstream is not actively marked as unhealthy. |
| 250 | // (This returns the status only from the "active" health checks.) |
| 251 | func (u *Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#) healthyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#healthy().() bool { |
| 252 | return u.unhealthyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#unhealthy..Loadscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int32#Load().() == 0 |
| 253 | } |
| 254 | |
| 255 | // SetHealthy sets the upstream has healthy or unhealthy |
| 256 | // and returns true if the new value is different. This |
| 257 | // sets the status only for the "active" health checks. |
| 258 | func (u *Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#) setHealthyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#setHealthy().(healthy bool) bool { |
| 259 | var unhealthy, compare int32 = 1, 0 |
| 260 | if healthy { |
| 261 | unhealthy, compare = 0, 1 |
| 262 | } |
| 263 | return u.unhealthyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream#unhealthy..CompareAndSwapscip-go gomod github.com/golang/go/src go1.25.1 `sync/atomic`/Int32#CompareAndSwap().(compare, unhealthy) |
| 264 | } |
| 265 | |
| 266 | // DialInfo contains information needed to dial a |
| 267 | // connection to an upstream host. This information |
| 268 | // may be different than that which is represented |
| 269 | // in a URL (for example, unix sockets don't have |
| 270 | // a host that can be represented in a URL, but |
| 271 | // they certainly have a network name and address). |
| 272 | type DialInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo# struct { |
| 273 | // Upstream is the Upstream associated with |
| 274 | // this DialInfo. It may be nil. |
| 275 | Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Upstream. *Upstreamscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Upstream# |
| 276 | |
| 277 | // The network to use. This should be one of |
| 278 | // the values that is accepted by net.Dial: |
| 279 | // https://golang.org/pkg/net/#Dial |
| 280 | Networkscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Network. string |
| 281 | |
| 282 | // The address to dial. Follows the same |
| 283 | // semantics and rules as net.Dial. |
| 284 | Addressscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Address. string |
| 285 | |
| 286 | // Host and Port are components of Address. |
| 287 | Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Host., Portscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Port. string |
| 288 | } |
| 289 | |
| 290 | // String returns the Caddy network address form |
| 291 | // by joining the network and address with a |
| 292 | // forward slash. |
| 293 | func (di DialInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#) Stringscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#String().() string { |
| 294 | return caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.JoinNetworkAddressscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/JoinNetworkAddress().(di.Networkscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Network., di.Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Host., di.Portscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#Port.) |
| 295 | } |
| 296 | |
| 297 | // GetDialInfo gets the upstream dialing info out of the context, |
| 298 | // and returns true if there was a valid value; false otherwise. |
| 299 | func GetDialInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/GetDialInfo().(ctx contextscip-go gomod github.com/golang/go/src go1.25.1 context/.Contextscip-go gomod github.com/golang/go/src go1.25.1 context/Context#) (DialInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#, bool) { |
| 300 | dialInfo, ok := caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.GetVarscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/GetVar().(ctx, dialInfoVarKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dialInfoVarKey.).(DialInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/DialInfo#) |
| 301 | return dialInfo, ok |
| 302 | } |
| 303 | |
| 304 | // hosts is the global repository for hosts that are |
| 305 | // currently in use by active configuration(s). This |
| 306 | // allows the state of remote hosts to be preserved |
| 307 | // through config reloads. |
| 308 | var hostsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/hosts. = caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.NewUsagePoolscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/NewUsagePool().() |
| 309 | |
| 310 | // dynamicHosts tracks hosts that were provisioned from dynamic upstream |
| 311 | // sources. Unlike static upstreams which are reference-counted via the |
| 312 | // UsagePool, dynamic upstream hosts are not reference-counted. Instead, |
| 313 | // their last-seen time is updated on each request, and a background |
| 314 | // goroutine evicts entries that have been idle for dynamicHostIdleExpiry. |
| 315 | // This preserves health state (e.g. passive fail counts) across requests |
| 316 | // to the same dynamic backend. |
| 317 | var ( |
| 318 | dynamicHostsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHosts. = make(map[string]dynamicHostEntryscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostEntry#) |
| 319 | dynamicHostsMuscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostsMu. syncscip-go gomod github.com/golang/go/src go1.25.1 sync/.RWMutexscip-go gomod github.com/golang/go/src go1.25.1 sync/RWMutex# |
| 320 | dynamicHostsCleanerOncescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostsCleanerOnce. syncscip-go gomod github.com/golang/go/src go1.25.1 sync/.Oncescip-go gomod github.com/golang/go/src go1.25.1 sync/Once# |
| 321 | dynamicHostCleanupIntervalscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostCleanupInterval. = 5 * timescip-go gomod github.com/golang/go/src go1.25.1 time/.Minutescip-go gomod github.com/golang/go/src go1.25.1 time/Minute. |
| 322 | dynamicHostIdleExpiryscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostIdleExpiry. = timescip-go gomod github.com/golang/go/src go1.25.1 time/.Hourscip-go gomod github.com/golang/go/src go1.25.1 time/Hour. |
| 323 | ) |
| 324 | |
| 325 | // dynamicHostEntry holds a Host and the last time it was seen |
| 326 | // in a set of dynamic upstreams returned for a request. |
| 327 | type dynamicHostEntryscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostEntry# struct { |
| 328 | hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostEntry#host. *Hostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/Host# |
| 329 | lastSeenscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dynamicHostEntry#lastSeen. timescip-go gomod github.com/golang/go/src go1.25.1 time/.Timescip-go gomod github.com/golang/go/src go1.25.1 time/Time# |
| 330 | } |
| 331 | |
| 332 | // dialInfoVarKey is the key used for the variable that holds |
| 333 | // the dial info for the upstream connection. |
| 334 | const dialInfoVarKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/dialInfoVarKey. = "reverse_proxy.dial_info" |
| 335 | |
| 336 | // proxyProtocolInfoVarKey is the key used for the variable that holds |
| 337 | // the proxy protocol info for the upstream connection. |
| 338 | const proxyProtocolInfoVarKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/proxyProtocolInfoVarKey. = "reverse_proxy.proxy_protocol_info" |
| 339 | |
| 340 | // ProxyProtocolInfo contains information needed to write proxy protocol to a |
| 341 | // connection to an upstream host. |
| 342 | type ProxyProtocolInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/ProxyProtocolInfo# struct { |
| 343 | AddrPortscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/ProxyProtocolInfo#AddrPort. netipscip-go gomod github.com/golang/go/src go1.25.1 `net/netip`/.AddrPortscip-go gomod github.com/golang/go/src go1.25.1 `net/netip`/AddrPort# |
| 344 | } |
| 345 | |
| 346 | // tlsH1OnlyVarKey is the key used that indicates the connection will use h1 only for TLS. |
| 347 | // https://github.com/caddyserver/caddy/issues/7292 |
| 348 | const tlsH1OnlyVarKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/tlsH1OnlyVarKey. = "reverse_proxy.tls_h1_only" |
| 349 | |
| 350 | // proxyVarKey is the key used that indicates the proxy server used for a request. |
| 351 | const proxyVarKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy`/proxyVarKey. = "reverse_proxy.proxy" |