forked from Snowiiii/Pumpkin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Query protocol (Snowiiii#218)
* Add query options to config Added packet data types Correctly parse a handshake packet Add tokio to pumpkin protocol for `AsyncReadExt` convenience functions * Add repr(u8) so that PacketType is a byte * Respond to handshake correctly * Allow for proper decoding of status packets and properly handle errors in decoding * Implement challange tokens and verify with token and address * Encode Basic status packet Switch to CString since its better to and null errors higher up the code * Encode Full status packet * Add forgotten fields to full status packet * Correctly respond to query clients when requesting full status * Return actual address and port of server Respect config options Remove uncessary debug derives * Remove packet type as it is redundant/unnecssary * Implement basic status request Refactor code for better error handling * Update README * Show players correctly in full status packet * Store all packets in structs instead of enums Break up en/decoding for each packet Reduce client tracking Get rid of QueryClients struct Stop storing of magic value and check during decoding Added tests for all decoding and encoding Fix all sugestions from @StripedMonkey
- Loading branch information
1 parent
ff4a710
commit 11c2c0d
Showing
8 changed files
with
553 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use serde_inline_default::serde_inline_default; | ||
|
||
#[serde_inline_default] | ||
#[derive(Deserialize, Serialize, Default)] | ||
pub struct QueryConfig { | ||
#[serde_inline_default(false)] | ||
pub enabled: bool, | ||
// Optional so if not specified the port server is running on will be used | ||
#[serde_inline_default(None)] | ||
pub port: Option<u16>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.