From 7264e7b92f8f74e53c1ee7b51260ca9514260e5c Mon Sep 17 00:00:00 2001
From: Bolke de Bruin <bolke@xs4all.nl>
Date: Tue, 21 Jul 2020 10:50:00 +0200
Subject: [PATCH] Do round robin selection

---
 download.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/download.go b/download.go
index 6415b61..bfd5e25 100644
--- a/download.go
+++ b/download.go
@@ -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)
-- 
GitLab