diff --git a/ping.go b/ping.go index d9ba68f..520efb8 100644 --- a/ping.go +++ b/ping.go @@ -512,19 +512,42 @@ func (p *Pinger) Statistics() *Statistics { return &s } +type expBackoff struct { + baseDelay time.Duration + maxExp int64 + c int64 +} + +func (b *expBackoff) Get() time.Duration { + if b.c < b.maxExp { + b.c++ + } + + return b.baseDelay * time.Duration(rand.Int63n(1<