Commit graph

298 commits

Author SHA1 Message Date
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
CosminPerRam
f7b5463073
[Crate] Add issue templates (#81) 2023-08-03 21:36:03 +03:00
Tom
fb447edbc2
[Docs] Add rustdoc checks to CI and tests to pre-commit (#83) 2023-08-02 17:44:42 +03:00
Tom
a4df444c86
[Docs] Improve generic example (#79)
- Allow entering DNS names that can be resolved
- Output a list of games if there is no game provided
2023-07-23 21:37:44 +03:00
CosminPerRam
ada60f2376 [Protocol] Fixed quake 2 bug that version wouldn't always be present 2023-07-22 16:17:52 +03:00
CosminPerRam
a81a6ef968 [Protocol] GS 1 rename Player's frags field to score to be more inline with the other protocols 2023-07-20 19:27:06 +03:00
CosminPerRam
bec0f518b4 [Crate] Bump version to 0.3.0 2023-07-18 15:58:49 +03:00
CosminPerRam
84118d2590 [Crate] Generalize dependencies 2023-07-18 15:52:47 +03:00
CosminPerRam
23669531b6 [Crate] Fix clippy lints 2023-07-18 15:31:35 +03:00
CosminPerRam
ea1360441c [Crate] Update CHANGELOG to add missing added changes. 2023-07-18 15:25:03 +03:00
Cain
66cc39eb26
[Crate] Refactor: Buffer (#62)
* merge: local -> fresh pr

* fix: utf16 bugs + clean up

* docs: buffer

* [feat/buffer] Replaced errors, partial valve protocol ported

* fix: change buffer name + add endian switch

* chore: update module

* refactor: valve_master

* refactor: mc bedrock

* refactor: mc java

* refactor: mc types

* refactor: mc legacy 1.8

* refactor: mc legacy 1.4

* refactor: valve

* refactor: valve types

* refactor: quake

* refactor: mc legacy 1.6

* refactor: gamespy 1

* fix: make switch endian move cursor

* fix: reset cursor on switch

* chore: add switch endian tests

* chore: remove todo comment

* chore: clean up buffer generic types

* refactor: prop len when switching in mc bedrock

* fix: tests and current pos fn

* refactor: ffow

* refactor: jc2mp

* refactor: gs 3

* refactor: gs 2

* fix: mc bedrock prop on move + move data

* fix: mc java lifetime error

* fix: mc legacy 1.6 using pub not pub crate

* fix: quake client lifetime

* fix: quake 2 clippy warning

* fix: valve lifetime issue

* fix: buffer test

* chore: format to keep ci happy

* fix: buffer move_cursor

* fix: quake client

* feat: GameSpy 1 small optimization

* fix: incomplete gamespy 3 fix

* fix: gamespy 3 fix

* fix: minecraft java

* fix: minecraft bedrock

* feat: update the CHANGELOG to mention the buffer rewrite and thank @cainthebest for it

* fix: minecraft legacy 1.6

---------

Co-authored-by: CosminPerRam <cosmin.p@live.com>
2023-07-18 11:46:53 +03:00
Tom
a8342296d6
[CI] Improve checks (#71)
* [CI] Improve checks

- Adds .actrc so CI actions can be tested locally
- Adds testing for variants of features so changes that break feature
  sets like disabling games can be caught
- Adds more of the CI tests to pre-commit

* [CI] Add more feature sets to test

* [CI] Check github actions before comitting

Requires act: https://github.com/nektos/act

* [CI] Add caching between builds

* [CI] Add caching everywhere

* [CI] Add more feature tests

* [CI] Add YAML schemas

* [CI] Disable audit when running locally

This is needed because the audit action requires a GITHUB_TOKEN which we
don't have when running locally.

* [CI] Move clippy to own job and use action that annotates PRs

Using actions-rs/clippy-check means that PRs will problems will
automatically have the relevant lines annotated

* [CI] Don't unnecessarily cache targets for fmt
2023-07-12 23:40:10 +03:00
Tom
fb9d15f0cc
[Crate] Bump rustfmt version to 1.6.0 (#69) 2023-07-10 18:32:17 +03:00
CosminPerRam
bf8c087b94
[CI] Using recommended CI Cargo audit Github action and update serde (#70)
* [CI] Using recommended CI Github action

* [Crate] Update serde dependencies
2023-07-10 17:09:22 +03:00
Tom
e207e8dc95
[Games] Add timeout settings for proprietary games (#67)
Adding query functions with timeout settings to proprietary games allows
the generic query with timeout function to pass the timeout settings
through.

This does change how the pre-existing FFOW query_with_timeout function
worked: it accepted a non-optional timeout settings, this was changed to
optional to be consistent with other query_with_timeout functions and to
move deciding what to do if the user doesn't provide timeout settings to
a more central location.

Closes #64
2023-07-10 16:17:49 +03:00