Commit graph

312 commits

Author SHA1 Message Date
CosminPerRam
40d4be2ceb Remove CosminPerRam from authors as he is not the sole maintainer anymore 2023-10-07 18:36:32 +03:00
CosminPerRam
311a5425a8
Remove minecraftping from game definitions as its useless (#117)
* Remove minecraftping from game definitions as its useless

* Update minecraftpocket name
2023-10-07 18:06:18 +03:00
CosminPerRam
5280ecb3c6
[Game] Apply new id naming (#114)
* Apply new id naming

* Fix failing CI on all features

* Update changelog

* Rename tf2 example to teamfortress2

* Fix typo in steamapp game names

* Rename minecraft legacy versions

* Apply CI node badge fix by Douile

* Add/Update badge

---------

Co-authored-by: GitHub Action <action@github.com>
2023-10-06 17:20:30 +03:00
Tom
b4c61781fb
Specify the branch name when pushing node badge commits (#116)
* [CI] Specify the branch name when pushing node badge commits

Fixes #115

* testing: remove games to update badge

* Add/Update badge

* Revert "testing: remove games to update badge"

This reverts commit 8256176839e996810568f5104a7c6a19ab482ab0.

* Add/Update badge

---------

Co-authored-by: GitHub Action <action@github.com>
2023-10-05 11:46:35 +03:00
CosminPerRam
9db873e774
Fix rule 3 example not following rule 2 (#113) 2023-10-04 11:20:03 +03:00
CosminPerRam
e7567c631e
[Repo] Add CONTRIBUTING.md. (#108)
* Add initial CONTRIBUTING.md file

* Update CONTRIBUTING.md

Co-authored-by: Tom <25043847+Douile@users.noreply.github.com>

* Specify to look whether there is an existing relevant issue first

* Specify that ids are lowercased only

* Fix tyope.

* Specify special case with multiple editions/versions

* Clarify an id already existing and fix typo

* Add new rule to specify what to do about names that being with numbers

* Simplify numbering rules

* Simplify numbering rules

* Specify on #1 unless #4 applies

* Specify naming for game names

* Add rule regarding mods that add ability for queries

* Remake rule 7 to include protocol naming

* Specify lowercase aplhanumeric

---------

Co-authored-by: Tom <25043847+Douile@users.noreply.github.com>
2023-10-02 23:38:31 +03:00
CosminPerRam
05eb902891
[Examples] Remove master_querant example due to being obsolete (#109) 2023-10-02 20:10:55 +03:00
CosminPerRam
9107bf5ef2 Update CHANGELOG.md to mention contributors 2023-10-01 12:34:10 +03:00
Tom
efc1828b29
[Protocol] Make gamespy1 parsing less likely to fail (#107)
* [Protocol] Gamespy1 don't skip "playername" field (#88)

* [Protocol] Gamespy1 make more player fields optional (#88)

These fields seem to be missing from bf1942 queries so make them
optional.
2023-09-27 17:07:42 +03:00
CosminPerRam
5bd609af72 [Crate] Update README to have a more title-like project name 2023-09-27 13:59:44 +03:00
Tom
c3281be419
[Protocol] Retry failed requests (#95)
* Add retry count to TimeoutSettings

This can be used to specify how many times to re-send requests that
fail. The default value is "1" so the if the first request fails, 1 more
attempt will be made.

* Add retries to valve queries

* [Protocol] &Optional<TimeoutSettings> add get_retries_or_default

Allow fetching the number of retries or the default retries value from a
borrowed optional TimeoutSettings.

* [Protocol] Add retries to minecraft protocol

* [Protocol] Add retries to quake

* [Protocol] Add retries to gamespy

* [Protocol] Update TimeoutSettings docs, and change default retries to 0

* Remove logging from retry_on_timeout

* [Protocol] TimeoutSettings make retries non-optional

* [Protocol] Move retry logic into lower level query functions

Retries are now implemented as wrappers on the single function that
would need to be retried on timeout.

In order to avoid cloning of TimeoutSettings, Socket::apply_timeouts()
was changed to accept a borrowed TimeoutSettings. And extra helpers were
added to the TimeoutSettings impl to reduce repetition.

* [Examples] Add retries to the generic example

* Also retry on PacketSend error

Sending packets could also timeout and until error_generic_member_access
is stable we have no way of determining the type of the underlying
`std::error::Error`.

* Add retry unit tests

* [Docs] Update changelog
2023-09-25 22:12:54 +03:00
GitHub Action
3784d25774 Add/Update badge 2023-09-22 21:20:17 +00:00
Tom
52750fba76
[Games] Update game definitions to match node-gamedig names (#100)
* [Games] Update game definitions to match node-gamedig names

* Update game file names to match definitions

* [Games] rename minecraft definitions to better match node

* [Games] Add test that all game files match definition name

* Update SteamApp to match node names

* [Games] Update the forest to match node-GameDig#367

* Clippy fix in games test

* [Docs] Update GAMES.md with new names

* [DOCS] Update changelog
2023-09-23 00:20:01 +03:00
Tom
14c3f4525b
[CI] Add node comparison badge (#99)
* [CI] Add node comparison badge

* Add/Update badge

---------

Co-authored-by: GitHub Action <action@github.com>
2023-09-21 23:51:10 +03:00
CosminPerRam
6b1e787cd2
[CI] Fix misc stuff with labeler CI. (#103)
* [CI] Fix games tag with the s

* [CI] Add labeler.yml as file for CI tag

* [CI] Also use checkout on triage
2023-09-21 23:37:11 +03:00
CosminPerRam
a8489e4353 [Crate] Remove license-file field due to cargo warning that only one is needed. 2023-09-21 23:18:25 +03:00
Tom
1a60a0496f
[CI] Only run build checks when a rust related file has changed (#102) 2023-09-21 23:03:12 +03:00
CosminPerRam
1c9f2dc0a8
[CI] Fix labeler permission on guest prs (#101)
* [CI] Fix permissions on guest prs

* Revert last commit

* Revert last commit

* Don't specify branch name in pr target

* Properly space on line

* Specify branch

* Add quotes to labeler points

* Remove the quotes on files in labeler.yml
2023-09-21 22:31:48 +03:00
CosminPerRam
2eb1d12b3d
[CI] Add github PR labeler (#97)
* Add labeler

* Run on prs

* Add move labeling
2023-09-17 21:59:19 +03:00
CosminPerRam
8468c2b821 [Crate] Update Cargo.toml to add license-file and categories fields 2023-09-11 14:57:49 +03:00
CosminPerRam
6179532065 [Crate] Changeup a doc comment 2023-09-10 23:27:06 +03:00
CosminPerRam
cb0486bded [Crate] Solve Cargo Doc redundant explicit link target 2023-09-10 23:14:13 +03:00
CosminPerRam
995ab23b51 [Crate] Separate error code into different files. 2023-09-10 23:12:18 +03:00
CosminPerRam
edbb0e6cf5 [Protocol] Valve: Rename compressed field to decompressed 2023-09-10 22:32:02 +03:00
CosminPerRam
b418319e01 [Protocol] GameSpy 3: Removed instance on unchecked .unwrap 2023-09-06 14:17:37 +03:00
CosminPerRam
527f8f6369 [Protocol] Valve: change up compressed packages structure to use Options 2023-09-06 13:46:52 +03:00
CosminPerRam
7cfecbfff9 [Game] Remove instances of using unwrap without handling the panics 2023-09-06 13:37:48 +03:00
CosminPerRam
d97bd68ada [Crate] Update CHANGELOG to move some stuff to breaking 2023-09-05 01:41:46 +03:00
Tom
6c1fdb1159
[Generic] Add struct for all extra request settings (#93)
* [Generic] Add struct for all extra request settings

Adds a new struct `ExtraRequestSettings` that contains all possible
extra settings for all protocols, and can be implicitly converted with
`.into()` into each protocol's extra settings type.

This is then used in a new query method
`query_with_timeout_and_extra_settings()` that passes the object on to
the selected protocol.

This also updates the generic example to set some of these generic
settings so that it can be used for certain queries like
"mc.hypixel.net".

* [Minecraft] Add `request_settings` parameter to auto query

This allows generic queries to pass through request settings when using
the `mc` game so that servers like `mc.hypixel.net` will still work when
using auto query.

* Fix generic examples tests (and enable example tests in pre-commit)
2023-09-05 01:13:12 +03:00
CosminPerRam
76a3ac2f78 [Game] Add Creativerse support. 2023-09-03 12:12:14 +03:00
CosminPerRam
89d69c1176 [Crate] Fix Changelog not mentioning rename/retype in protocols block 2023-09-01 22:44:05 +03:00
CosminPerRam
e1568f4019 [Crate] Add RequestSettings to CHANGELOG 2023-09-01 22:41:42 +03:00
CosminPerRam
a56ca45de6
[Protocol] Fix Minecraft Java query not being able to specify a hostname (#91)
* Make initial fix

* Fix imports

* Rename query_address to hostname and add this to the mc example

* Fix master_querant example not compiling

* Add extra safety on converting strings to Minecraft Varint strings

* Add docs to RequestSettings

* Fix formatting
2023-09-01 22:21:08 +03:00
CosminPerRam
211cd5fd5f [Crate] Update LICENSE.md to specify GameDig organization 2023-08-23 21:24:25 +03:00
CosminPerRam
51c7e2383e [Crate] Update LICENSE.md to specify GameDig developers 2023-08-23 21:12:54 +03:00
CosminPerRam
a8fc67412c [Protocol] Fix an instance of unwrapping in The Ship 2023-08-17 23:08:59 +03:00
CosminPerRam
7e028ce97d [Protocol] Remove Minecraft unused function to convert a string to bytes 2023-08-17 22:50:23 +03:00
CosminPerRam
f50c50f0f1 [Protocol] Apply many nursery clippy lints 2023-08-17 22:37:17 +03:00
CosminPerRam
c4097fae78 [Crate] Update CHANGELOG with check_app_id addition and player score being fixed. 2023-08-15 22:05:59 +03:00
CosminPerRam
b35e52f795
[Protocol] Add app id checking to valve protocol in gather settings (#87) 2023-08-15 22:00:20 +03:00
CosminPerRam
071fc367df [Protocol] Add buffer comment to refactor at some point remaining_bytes 2023-08-15 21:36:40 +03:00
CosminPerRam
9d8fb1ba94
[Protocol] Standardize fields (#84)
* [Protocol] Standardize The Ship fields

* [Protocol] Standardize FFOW fields

* [Protocol] Rename Valve's protocol field to protocol_version

* [Protocol] Rename Minecraft's version_protocol field to protocol_version

* [Protocol] Rename Valve's version field to game_version

* [Protocol] Rename Minecraft java version_name to game_version

* [Crate] Reformat RESPONSES.md

* [Protocol] Renamed Minecraft Java players_sample to players

* [Protocol] Rename Quake (1,2,3) version field to game_version

* [Protocol] Rename quake (1 and 2) game_type field to game_mode

* [Protocol] Rename Valve, FFOW, TS game field to game_mode

* [Generics] Rename game field/function to game_mode

* [Protocol] Change players_minimum, _maximum and _bots from those who werent u8 or u32 to u32

* [Protocol] Change instances of player score field type from u32 to i32

* [Crate] Nicer gramar in CHANGELOG

* [Protocol] Apply clippy fixes
2023-08-15 20:44:18 +03:00
CosminPerRam
65c56dc196 [Service] Fix valve master server ip gatherer being broken (again) 2023-08-08 18:43:33 +03:00
CosminPerRam
c10555a9d7 [Service] Fix valve master server ip gatherer being broken 2023-08-08 18:42:43 +03:00
CosminPerRam
b509a6dcc4 [Crate] Convert pub(crate) to pub in buffer as its not exported externally 2023-08-06 21:55:39 +03:00
CosminPerRam
5aa2ce99ec [Crate] Apply strict clippy on buffer 2023-08-06 21:54:19 +03:00
CosminPerRam
4ff50ea711 [Crate] Apply strict clippy suggestions and fix doc line. 2023-08-06 21:50:17 +03:00
CosminPerRam
47547a77bd [Crate] Remove unnecessary path prefix in error code 2023-08-06 21:32:44 +03:00
CosminPerRam
c43cc0438a [Crate] Update CHANGELOG.md 2023-08-06 21:29:40 +03:00
Tom
5e7e010d24
[Crate] Add rich error type (#80)
* Add rich error type with source and backtrace

Adds a rich error type that will take a backtrace and allow capturing
the source of the error. The best way to use this is with the included
helpers that will automatically capture the backtrace and convert the
source error:

```
GDRichError::packet_bad_from_into("Reason packet was bad")
```

* [Crate] Bump MSRV to 1.65.0

This is required for backtraces in rich errors.

* Remove leftover debug logging

* [Errors] Replace variant overloads with single .rich method on kind enum

This overhaul replaces the exhaustive impls of each variant as multiple
methods on the rich error type with a singular .rich() method on the
kind enum. This consumes the variant and converts it to a rich error
with a source (.into() can be used if a source is not needed).

I also took the liberty of replacing all usages with the this new method
as I saw fit (adding various error messages) and converting a few
PacketBad errors to TypeParse errors when they are the result of parse
failing.

* Fix problem with rustdoc

* Remove BadGame's owned string

* Rename GDError to GDErrorKind

* Rename GDRichError to GDError

* Remove error impl from GDErrorKind

* Fix tests not passing

* Use error context everywhere map_err is used

* Improve GDError display formatter

* Add tests for new error type
2023-08-05 12:36:48 +03:00