only give short server (e.g. de5) as output

This commit is contained in:
Bastian Doetsch 2022-03-06 16:51:45 +01:00
parent 2dfdb1ad74
commit 5821d890b8

View File

@ -9,6 +9,7 @@ import (
"io"
"io/ioutil"
"net/http"
"strings"
"time"
)
@ -19,7 +20,8 @@ func main() {
servers := getServers()
bestIndex := selectBestServerIndex(servers)
log.Debug().Interface("server", servers[bestIndex]).Msg("Best latency server found.")
fmt.Println(servers[bestIndex].Hostname)
hostname := strings.Split(servers[bestIndex].Hostname, "-")[0]
fmt.Println(hostname)
}
func selectBestServerIndex(servers []server) int {