mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2024-12-11 22:35:40 +01:00
Fix: Randomize source URLs (#1593)
This commit is contained in:
parent
0ab9e30fa9
commit
a9cf16b33e
@ -788,6 +788,9 @@ func (config *Config) printRegisteredServers(proxy *Proxy, jsonOutput bool) erro
|
||||
func (config *Config) loadSources(proxy *Proxy) error {
|
||||
for cfgSourceName, cfgSource_ := range config.SourcesConfig {
|
||||
cfgSource := cfgSource_
|
||||
rand.Shuffle(len(cfgSource.URLs), func(i, j int) {
|
||||
cfgSource.URLs[i], cfgSource.URLs[j] = cfgSource.URLs[j], cfgSource.URLs[i]
|
||||
})
|
||||
if err := config.loadSource(proxy, cfgSourceName, &cfgSource); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -197,9 +197,6 @@ func NewSource(name string, xTransport *XTransport, urls []string, minisignKeySt
|
||||
return source, err
|
||||
}
|
||||
source.parseURLs(urls)
|
||||
rand.Shuffle(len(source.urls), func(i, j int) {
|
||||
source.urls[i], source.urls[j] = source.urls[j], source.urls[i]
|
||||
})
|
||||
if _, err = source.fetchWithCache(xTransport, timeNow()); err == nil {
|
||||
dlog.Noticef("Source [%s] loaded", name)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user