1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-12 22:36:32 +01:00

Randomize source URLs

Fixes #1577
This commit is contained in:
Frank Denis 2021-01-04 16:41:39 +01:00
parent 19dbd13c1b
commit 85d268f2b9

View File

@ -197,6 +197,9 @@ func NewSource(name string, xTransport *XTransport, urls []string, minisignKeySt
return source, err return source, err
} }
source.parseURLs(urls) 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 { if _, err = source.fetchWithCache(xTransport, timeNow()); err == nil {
dlog.Noticef("Source [%s] loaded", name) dlog.Noticef("Source [%s] loaded", name)
} }