summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy/hosts.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-03-27 14:29:01 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-03-27 14:29:01 -0600
commite207240f9a6def2e29abf0947a660ab84f858016 (patch)
treeb9d09ddcc16246d5efad84ed29623481a38f9f41 /modules/caddyhttp/reverseproxy/hosts.go
parent397e04ebd9802d711a109822c3304bdf87b3a1ce (diff)
reverse_proxy: Upstream.String() method returns either LookupSRV or Dial
Either Dial or LookupSRV will be set, but if we rely on Dial always being set, we could run into bugs. Note: Health checks don't support SRV upstreams.
Diffstat (limited to 'modules/caddyhttp/reverseproxy/hosts.go')
-rw-r--r--modules/caddyhttp/reverseproxy/hosts.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/caddyhttp/reverseproxy/hosts.go b/modules/caddyhttp/reverseproxy/hosts.go
index a7709ee..87139c3 100644
--- a/modules/caddyhttp/reverseproxy/hosts.go
+++ b/modules/caddyhttp/reverseproxy/hosts.go
@@ -96,6 +96,13 @@ type Upstream struct {
cb CircuitBreaker
}
+func (u Upstream) String() string {
+ if u.LookupSRV != "" {
+ return u.LookupSRV
+ }
+ return u.Dial
+}
+
// Available returns true if the remote host
// is available to receive requests. This is
// the method that should be used by selection