The official Go library for interacting with the mcstatus.io API.
Firstly, you will need to install the library. Open your terminal/command line in your workspace and run the following command.
go get github.com/mcstatus-io/go-mcstatus
package main
import (
"fmt"
"github.com/mcstatus-io/go-mcstatus"
)
func main() {
resp, err := mcstatus.GetJavaStatus("demo.mcstatus.io", 25565)
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", resp)
}
package main
import (
"fmt"
"github.com/mcstatus-io/go-mcstatus"
)
func main() {
resp, err := mcstatus.GetBedrockStatus("demo.mcstatus.io", 19132)
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", resp)
}
package main
import "github.com/mcstatus-io/go-mcstatus"
func main() {
img, err := mcstatus.GetJavaWidget("demo.mcstatus.io", 25565)
if err != nil {
panic(err)
}
// ...
}
package main
import "github.com/mcstatus-io/go-mcstatus"
func main() {
img, err := mcstatus.GetIcon("demo.mcstatus.io", 25565)
if err != nil {
panic(err)
}
// ...
}
package main
import "github.com/mcstatus-io/go-mcstatus"
func main() {
img := mcstatus.GetDefaultIcon()
// ...
}