add registry base interface, mdns, noop implementations, add resolver, client

This commit is contained in:
2020-11-08 19:28:33 +01:00
parent 87b947cea3
commit 9f5f03b862
29 changed files with 4341 additions and 41 deletions

16
utils/backoff/backoff.go Normal file
View File

@ -0,0 +1,16 @@
// Package backoff provides backoff functionality
package backoff
import (
"math"
"time"
)
// Do is a function x^e multiplied by a factor of 0.1 second.
// Result is limited to 2 minute.
func Do(attempts int) time.Duration {
if attempts > 13 {
return 2 * time.Minute
}
return time.Duration(math.Pow(float64(attempts), math.E)) * time.Millisecond * 100
}