From 5621abe5e7d2b86dd1d76011390699664b13478d Mon Sep 17 00:00:00 2001 From: Chandler Swift Date: Sun, 29 Mar 2020 21:32:18 -0500 Subject: [PATCH] Add Version string --- factorio-site.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/factorio-site.go b/factorio-site.go index d3ef01d..b5b5ed6 100644 --- a/factorio-site.go +++ b/factorio-site.go @@ -17,6 +17,7 @@ type serverData struct { Port int Title string Players string + Version string } func main() { @@ -61,12 +62,25 @@ func main() { return } + _, err = rconConnection.Write("/version") + if err != nil { + fmt.Print(w, "Error connecting to server") + return + } + + version, _, err := rconConnection.Read() + if err != nil { + fmt.Print(w, "Error receiving data from server") + return + } + data := []serverData{} data = append(data, serverData{ *serverAddr, 34197, "Server with Bob's Mod, est. Feb 2020", playersOnline, + version, }) t.Execute(w, data)