Do round robin selection

This commit is contained in:
Bolke de Bruin 2020-07-21 10:50:00 +02:00
parent 55df8df3bc
commit 7264e7b92f

View file

@ -28,7 +28,9 @@ func handleRdpDownload(w http.ResponseWriter, r *http.Request) {
return
}
var host = conf.Server.HostTemplate
// do a round robin selection for now
rand.Seed(time.Now().Unix())
var host = conf.Server.Hosts[rand.Intn(len(conf.Server.Hosts))]
for k, v := range data.(map[string]interface{}) {
if val, ok := v.(string); ok == true {
host = strings.Replace(host, "{{ " + k + " }}", val, 1)