func (backo *Backo) Sleep(attempt int) {
	duration := backo.Duration(attempt)
	time.Sleep(duration)
}
Sleep pauses the current goroutine for the backoff interval for the given attempt.
package backo
import (
	"math"
	"math/rand"
	"time"
)
type Backo struct {
	base   time.Duration
	factor uint8
	jitter float64
	cap    time.Duration
}
func NewBacko(base time.Duration, factor uint8, jitter float64, cap time.Duration) *Backo {
	return &Backo{base, factor, jitter, cap}
}
func DefaultBacko() *Backo {
	return NewBacko(time.Millisecond*100, 2, 0, time.Second*10)
}
func (backo *Backo) Duration(attempt int) time.Duration {
	duration := float64(backo.base) * math.Pow(float64(backo.factor), float64(attempt))
	if backo.jitter != 0 {
		random := rand.Float64()
		deviation := math.Floor(random * backo.jitter * duration)
		if (int(math.Floor(random*10)) & 1) == 0 {
			duration = duration - deviation
		} else {
			duration = duration + deviation
		}
	}
	duration = math.Min(float64(duration), float64(backo.cap))
	return time.Duration(duration)
}