From 5821d890b820153e8c2df67434dfe2c0f33844eb Mon Sep 17 00:00:00 2001 From: Bastian Doetsch Date: Sun, 6 Mar 2022 16:51:45 +0100 Subject: [PATCH] only give short server (e.g. de5) as output --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index c04397f..7d86e36 100644 --- a/main.go +++ b/main.go @@ -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 {