package balancer type failover struct{} // Failover returns a strategy that always picks the first healthy endpoint. // If the primary endpoint is unhealthy, it falls back to the next available // healthy endpoint in order. func Failover() Strategy { return &failover{} } func (f *failover) Next(healthy []Endpoint) (Endpoint, error) { if len(healthy) == 0 { return Endpoint{}, ErrNoHealthy } return healthy[0], nil }