Add Version string

This commit is contained in:
Chandler Swift 2020-03-29 21:32:18 -05:00
parent 2d0e07b59f
commit 5621abe5e7

View file

@ -17,6 +17,7 @@ type serverData struct {
Port int Port int
Title string Title string
Players string Players string
Version string
} }
func main() { func main() {
@ -61,12 +62,25 @@ func main() {
return 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 := []serverData{}
data = append(data, serverData{ data = append(data, serverData{
*serverAddr, *serverAddr,
34197, 34197,
"Server with Bob's Mod, est. Feb 2020", "Server with Bob's Mod, est. Feb 2020",
playersOnline, playersOnline,
version,
}) })
t.Execute(w, data) t.Execute(w, data)