2022-06-09 23:47:12 +00:00
|
|
|
package updater
|
2021-05-08 00:59:42 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/qdm12/gluetun/internal/updater/resolver"
|
|
|
|
|
)
|
|
|
|
|
|
2022-06-11 17:41:57 +00:00
|
|
|
func parallelResolverSettings(hosts []string) (settings resolver.ParallelSettings) {
|
2021-05-08 00:59:42 +00:00
|
|
|
const (
|
|
|
|
|
maxFailRatio = 1
|
2021-06-21 20:29:55 +00:00
|
|
|
maxDuration = 20 * time.Second
|
|
|
|
|
betweenDuration = time.Second
|
|
|
|
|
maxNoNew = 4
|
2021-05-08 00:59:42 +00:00
|
|
|
maxFails = 10
|
|
|
|
|
)
|
2022-06-11 17:41:57 +00:00
|
|
|
return resolver.ParallelSettings{
|
|
|
|
|
Hosts: hosts,
|
2021-05-08 00:59:42 +00:00
|
|
|
MaxFailRatio: maxFailRatio,
|
|
|
|
|
Repeat: resolver.RepeatSettings{
|
|
|
|
|
MaxDuration: maxDuration,
|
|
|
|
|
BetweenDuration: betweenDuration,
|
|
|
|
|
MaxNoNew: maxNoNew,
|
|
|
|
|
MaxFails: maxFails,
|
|
|
|
|
SortIPs: true,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|