package main import ( "fmt" "github.com/iverly/go-mcping/mcping" ) func pingMinecraft(ip string) { // Create a new Pinger instance pinger := mcping.NewPinger() // Ping the Minecraft server response, err := pinger.Ping(ip, 25565) if err != nil { fmt.Println("Failed to ping server: %v\n", err) return } // Print server information fmt.Println("Server Version: %s\n", response.Version) fmt.Println("Players Online: %d / %d\n", response.PlayerCount.Online, response.PlayerCount.Max) fmt.Println("MOTD: %s\n", response.Motd) fmt.Println("Latency: %d ms\n", response.Latency) }