func (u *Upstream) Full() bool {
	return u.MaxRequests > 0 && u.Host.NumRequests() >= u.MaxRequests
}
Full returns true if the remote host
cannot receive more requests at this time.
package reverseproxy
import (
	"context"
	"fmt"
	"net"
	"net/http"
	"strconv"
	"sync/atomic"
	"github.com/caddyserver/caddy/v2"
	"github.com/caddyserver/caddy/v2/modules/caddyhttp"
)
type Host interface {
	NumRequests() int
	Fails() int
	Unhealthy() bool
	CountRequest(int) error
	CountFail(int) error
	SetHealthy(bool) (bool, error)
}
type UpstreamPool []*Upstream
type Upstream struct {
	Host `json:"-"`
	Dial string `json:"dial,omitempty"`
	LookupSRV string `json:"lookup_srv,omitempty"`
	MaxRequests int `json:"max_requests,omitempty"`
	activeHealthCheckPort int
	healthCheckPolicy     *PassiveHealthChecks
	cb                    CircuitBreaker
}
func (u Upstream) String() string {
	if u.LookupSRV != "" {
		return u.LookupSRV
	}
	return u.Dial
}
func (u *Upstream) Available() bool {
	return u.Healthy() && !u.Full()
}
func (u *Upstream) Healthy() bool {
	healthy := !u.Host.Unhealthy()
	if healthy && u.healthCheckPolicy != nil {
		healthy = u.Host.Fails() < u.healthCheckPolicy.MaxFails
	}
	if healthy && u.cb != nil {
		healthy = u.cb.OK()
	}
	return healthy
}