From f4c80983822519606b9d4f6d423482636f32dd74 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Tue, 26 Jul 2022 13:42:07 +0200 Subject: [PATCH 1/2] Fix readme issues --- README.md | 49 +++++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index baf9fe8..dfe167b 100644 --- a/README.md +++ b/README.md @@ -25,17 +25,16 @@

-# 🚀 Migrating from v1 +## 🚀 Migrating from v1 If you're new to MineQuery, you can skip this part. If you have used it before, you might want to give it a read if you're planning to switch from v1. See [MIGRATING.md] for help with migrating from MineQuery v1 to v2. -[MIGRATING.md]: MIGRATING.md -# #️⃣ Minecraft Version Support +## #️⃣ Minecraft Version Support As of version 2.0.0, MineQuery supports pinging of all versions of Minecraft. @@ -43,25 +42,15 @@ As of version 2.0.0, MineQuery supports pinging of all versions of Minecraft. |-------------------|-------------|--------------|-------------| | ✅ Supported | ✅ Supported | ✅ Supported | ✅ Supported | -[Beta 1.8 to 1.3]: https://wiki.vg/Server_List_Ping#Beta_1.8_to_1.3 - -[1.4]: https://wiki.vg/Server_List_Ping#1.4_to_1.5 - -[1.6 to 1.7]: https://wiki.vg/Server_List_Ping#1.6 - -[1.7+]: https://wiki.vg/Server_List_Ping#Current - -## Query Protocol Support +### Query Protocol Support As of version 2.0.0, query protocol is not yet supported. See [issue #25] to track progress. -[issue #25]: https://github.com/alteamc/minequery/issues/25 - -# 📚 How to use +## 📚 How to use -## Basic usage +### Basic usage For simple pinging with default parameters, use package-global `Ping*` functions (where `*` is your respective Minecraft server version.) @@ -79,12 +68,9 @@ fmt.Println(res) For full info on response object structure, see [documentation]. -[documentation]: https://pkg.go.dev/github.com/alteamc/minequery/v2 +### Advanced usage - -## Advanced usage - -### Pinger +#### Pinger For more advanced usage, such as setting custom timeout or enabling more strict response validation, you can use `Pinger` struct with `PingerOption` passed to it: @@ -111,16 +97,14 @@ pinger.Ping16("localhost", 25565) pinger.Ping17("localhost", 25565) ``` -[Basic usage]: #basic-usage - -### WithTimeout +#### WithTimeout By default, `Pinger` has 15-second timeout before connection aborts. If you need to customize this duration, you can use `WithTimeout` option. -### WithUseStrict +#### WithUseStrict By default, `Pinger` does not validate response data it receives and silently omits erroneous values it processes (incorrect favicon or bad player UUID). @@ -128,15 +112,24 @@ If you need it to return an error in case of invalid response, you can use `WithUseStrict` option. -### WithProtocolVersion16 +#### WithProtocolVersion16 By default, `Pinger` sends protocol version 74 in 1.6 ping packets. If you need to customize protocol version sent, use `WithProtocolVersion16`. MineQuery provides a convenient set of constants you can use — see `Ping16ProtocolVersion*` constants. -### WithProtocolVersion17 +#### WithProtocolVersion17 By default, `Pinger` sends protocol version -1 in 1.7 ping packets. If you need to customize protocol version sent, use `WithProtocolVersion17`. MineQuery provides -a convenient set of constants you can use — see `Ping17ProtocolVersion*` constants. \ No newline at end of file +a convenient set of constants you can use — see `Ping17ProtocolVersion*` constants. + +[MIGRATING.md]: MIGRATING.md +[Beta 1.8 to 1.3]: https://wiki.vg/Server_List_Ping#Beta_1.8_to_1.3 +[1.4]: https://wiki.vg/Server_List_Ping#1.4_to_1.5 +[1.6 to 1.7]: https://wiki.vg/Server_List_Ping#1.6 +[1.7+]: https://wiki.vg/Server_List_Ping#Current +[issue #25]: https://github.com/alteamc/minequery/issues/25 +[documentation]: https://pkg.go.dev/github.com/alteamc/minequery/v2 +[Basic usage]: #basic-usage \ No newline at end of file From d2dabd5b7c61e9303b15d0c73fac8d851d19e2a8 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Tue, 26 Jul 2022 13:52:41 +0200 Subject: [PATCH 2/2] Remove spaces --- MIGRATING.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/MIGRATING.md b/MIGRATING.md index 383ba5e..3cae3cb 100644 --- a/MIGRATING.md +++ b/MIGRATING.md @@ -10,17 +10,14 @@ All `Ping*` functions now take `*Pinger` pointer as receiver. `IsIncompatible()` now takes `*Status16` pointer as receiver. - ## Parameters `WithDialer` option now takes `*net.Dialer` as parameter. - ## Fields `Pinger` struct now has `Dialer *net.Dialer` field. - # 🚀 Migrating from v1 Version 2 of MineQuery has several breaking changes from version 1. This section @@ -35,7 +32,6 @@ also changed: |----------------------------------------------|--------------------------------------------| | `import "github.com/alteamc/minequery/ping"` | `import "github.com/alteamc/minequery/v2"` | - ## New ping function signatures To remove own names (Legacy, Ancient) of Minecraft versions, it has been decided to @@ -47,7 +43,6 @@ rename `Ping*` functions per `PingVERSION` scheme. See table below for reference | `ping.PingLegacy(host string, port int) (*ping.LegacyResponse, error)` | `minequery.Ping16(host string, port int) (*minequery.Status16, error)`

⚠️ **Note!** MineQuery v1 does not differentiate 1.4 and 1.6 pings and the above example pings 1.6 servers. Use `minequery.Ping14(host string, port int) (*minequery.Status14, error)` to ping 1.4 servers. | | `ping.PingAncient(host string, port int) (*ping.AncientResponse, error)` | `minequery.PingBeta18(host string, port int) (*minequery.StatusBeta18, error)` | - ## New response structure naming and signatures Per same reasoning as ping function renaming, response structs also have been renamed. @@ -70,7 +65,6 @@ See table below for reference (applies both to `ping.LegacyResponse` and `ping.A | `MessageOfTheDay` | `MOTD` | | `PlayerCount` | `OnlinePlayers` | - `ping.Response` has been heavily reworked (mostly, due to flattening) with fields renamed, nested structs flattened and new fields added. See table below for reference. @@ -86,5 +80,4 @@ nested structs flattened and new fields added. See table below for reference. | `Favicon` | `Icon`

⚠️ **Note!** MineQuery v1 did not process icon in any way, v2 decodes it into `image.Image` instance. | | *New in v2* | `PreviewsChat` | - [Package renaming]: #package-renaming \ No newline at end of file