mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-17 14:10:09 +02:00
hotfix(provider/utils): randomize pool of filterd servers to pick connections from
This commit is contained in:
@@ -2,6 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand/v2"
|
||||
"slices"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/configuration/settings"
|
||||
@@ -44,6 +45,12 @@ func GetConnection(provider string,
|
||||
return connection, fmt.Errorf("filtering servers: %w", err)
|
||||
}
|
||||
|
||||
// Randomize order of the servers struct so the first connection to be picked
|
||||
// won't always be the same one.
|
||||
rand.Shuffle(len(servers), func(i, j int) {
|
||||
servers[i], servers[j] = servers[j], servers[i]
|
||||
})
|
||||
|
||||
protocol := getProtocol(selection)
|
||||
port := getPort(selection, defaults.OpenVPNTCPPort,
|
||||
defaults.OpenVPNUDPPort, defaults.WireguardPort)
|
||||
|
||||
Reference in New Issue
Block a user