28 lines
596 B
Go
28 lines
596 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
//resp, err := PingHostname("play.survival-games.cz", 25565)
|
|
resp, err := PingHostname("127.0.0.2", 25565)
|
|
//resp, err := PingHostname("vps.brn.systems", 25965)
|
|
if err != nil {
|
|
fmt.Println("Ty debil")
|
|
fmt.Println(err)
|
|
}
|
|
// Pretty print the response
|
|
respJson, err := json.MarshalIndent(resp, "", " ")
|
|
if err != nil {
|
|
fmt.Println("Error marshalling response to JSON:", err)
|
|
return
|
|
}
|
|
err = os.WriteFile("out/server.json", respJson, 0644)
|
|
if err != nil {
|
|
fmt.Println("Error creating server.json:", err)
|
|
}
|
|
}
|