aboutsummaryrefslogtreecommitdiff
path: root/plugin/proxy/down.go
blob: 11f839b466255e9c2ec953af6c124947904eb610 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package proxy

import (
	"sync/atomic"

	"github.com/coredns/coredns/plugin/pkg/healthcheck"
)

// Default CheckDown functions for use in the proxy plugin.
var checkDownFunc = func(upstream *staticUpstream) healthcheck.UpstreamHostDownFunc {
	return func(uh *healthcheck.UpstreamHost) bool {
		fails := atomic.LoadInt32(&uh.Fails)
		if fails >= upstream.MaxFails && upstream.MaxFails != 0 {
			return true
		}
		return false
	}
}