feat(dev): Add provider example package

This commit is contained in:
Quentin McGaw
2022-07-02 20:58:04 +00:00
parent 34e67f9f99
commit 420ae40901
8 changed files with 319 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
package updater
import (
"time"
"github.com/qdm12/gluetun/internal/updater/resolver"
)
// TODO: remove this file if the parallel resolver is not used
// by the updater.
func parallelResolverSettings(hosts []string) (settings resolver.ParallelSettings) {
// TODO: adapt these constant values below to make the resolution
// as fast and as reliable as possible.
const (
maxFailRatio = 0.1
maxDuration = 20 * time.Second
betweenDuration = time.Second
maxNoNew = 2
maxFails = 2
)
return resolver.ParallelSettings{
Hosts: hosts,
MaxFailRatio: maxFailRatio,
Repeat: resolver.RepeatSettings{
MaxDuration: maxDuration,
BetweenDuration: betweenDuration,
MaxNoNew: maxNoNew,
MaxFails: maxFails,
SortIPs: true,
},
}
}