Commit graph

27 commits

Author SHA1 Message Date
CosminPerRam
995ab23b51 [Crate] Separate error code into different files. 2023-09-10 23:12:18 +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
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
Tom
fb9d15f0cc
[Crate] Bump rustfmt version to 1.6.0 (#69) 2023-07-10 18:32:17 +03:00
CosminPerRam
0ceb31bf86 [Crate] Apply cargo clippy fixes 2023-05-30 15:49:35 +03:00
Cain
1b13d39856
[Crate] Add formatting (#22)
* chore: add standard for formatting

* chore: manually tidy up imports and format

* chore: remove vscode and add to gitignore

* chore: alphabetically order and fix

* chore: format

* chore: fix format issue with payload

* chore: format as merge had unformatted code

* [format] Fix comments, change max width and binop operator

---------

Co-authored-by: CosminPerRam <cosmin.p@live.com>
2023-03-14 10:31:37 +02:00
Cain
bf2a05f488
[Tests] result, display, trait and cloning (#19) 2023-03-10 22:27:30 +02:00
CosminPerRam
3928d3a818 Implement std::error::Error for GDError 2023-01-13 01:00:31 +02:00
CosminPerRam
e72d7bdf8b Revert error details for the BadGame error 2023-01-13 00:39:58 +02:00
CosminPerRam
c263b17651 Remove errors details as they were quite useless 2023-01-13 00:11:04 +02:00
CosminPerRam
91f8bbb9fe
Minecraft bedrock support (#7)
* Added needed ground stuff

* Minecraft bedrock support!

* Documentation acknowledgements!

* Added utf8_le_undended test, some docs and modified master_querant

* Modified query function to comply with the others

Before: game query -> protocol query (get port or default port)
After: game query (get port or default port) -> protocol query

* Modified md files
2022-12-05 18:47:35 +02:00
CosminPerRam
2e8aa50c3a Fixed tests and removed dns error 2022-11-28 01:22:59 +02:00
CosminPerRam
7b44c5f7eb Reverter errors from taking a &'static str to String 2022-11-25 18:42:10 +02:00
CosminPerRam
dc0926bab7 Renamed ProtocolRule to ProtocolFormat 2022-11-24 23:41:23 +02:00
CosminPerRam
304b8340d2 Better, faster and stronger errors. 2022-11-24 23:38:51 +02:00
CosminPerRam
ee0223a7a3
Minecraft implementation (#6)
* Initial minecraft support

* Made previews_chat an option

* Better error handling and removed version structure

* Minecraft Server types

* Fixed compilation and renamed stuff

* 'extract till you drop!' extracted sockets

* extracted java version and fixed socket udp receive

* Legacy 1.4 and 1.6 implementation (incomplete)

* Furter implementation

* Implementations work

* Protocol beta v1.8+ implemented

* Removed bedrock support

* Added auto query

* Renamed minecraft to mc and added to md's

* Docs, renames and small optimization changes

* Changed java version to be able to return None on players sample
2022-11-24 22:52:54 +02:00
CosminPerRam
caa7329a68 Added socket timeout capability and reduced PACKET_SIZE to 1400 as specified from protocol 2022-11-15 21:07:15 +02:00
CosminPerRam
d3a1dba3c1
Restructured app format, goldsrc full support and added implementation for Day of Defeat and Counter-Strike: Condition Zero (#5)
* [valve_app_restructure] Initial change

* [valve_app_restructure] Some GoldSrc split packet changes

* [valve_app_restructure] Counter-Strike: Condition Zero implementation.

* [valve_app_restructure] Docs changes

* [valve_app_restructure] Added obsolete gold src response

* [valve_app_restructure] Day of Defeat implementation.
2022-10-27 01:01:11 +03:00
CosminPerRam
e8cbe7b9f5
DNS Resolver Implementation (#4)
* [dns-resolver] Added trust-dns-resolver and restored cargo.lock

* [dns_resolver] Implemented feature
2022-10-22 14:58:59 +03:00
cosminperram
3b4dd9d9e4 Decompression support 2022-10-22 02:27:11 +03:00
CosminPerRam
15e6ad5892 Replaced Result<T, GDError> with GDResult<T> 2022-10-20 23:19:57 +03:00
CosminPerRam
00ead6d946 Documentation update 2022-10-20 12:49:22 +03:00
CosminPerRam
192d50a11d Specified MIT license and made the valve protocol check if the queried game is the right game 2022-10-18 18:20:37 +03:00
CosminPerRam
9ab4b8a7fd Error handling and better structure 2022-10-17 23:22:46 +03:00
CosminPerRam
544ce897c5 Better protocol parameters and utils tests 2022-10-17 11:11:40 +03:00
CosminPerRam
8098136d09 Initial valve setup and tf2 game setup 2022-10-15 22:20:01 +03:00