Axum HTTP tracker: basic scaffolding#180
Merged
josecelano merged 4 commits intotorrust:developfrom Feb 9, 2023
Merged
Conversation
We are going to migrate the HTTP tracker from Warp to Axum. This is the basic scaffolding for Axum. Tests have been duplicated to test the new Axum implementation. The setup allows executing both versions: the Warp version on production and both versions (Warp and Axum) on testing env.
…params from url query WIP: only for mandatory params.
…tracker implementations We are going to start sharing code bettween both implementation (Warp and Axum). We need to keep common code separated because Warp implementation will be removed when Axum implementation is finished.
Contributor
|
ACK 995397e |
17 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the first of a series of PR associated with the issue #160
We are changing the HTTP tracker to use Axum instead of Warp. This PR allows:
It also allows parsing the URL query params for the announce query. For the time being, only the mandatory params.
The announce request URL has two parameters that contain binary data (20 bytes).
Sample Announce URL:
http://0.0.0.0:7070/announce?info_hash=%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0&peer_id=-qB00000000000000001&port=17548
The "infohash" and "peer id" cannot be extracted using the generic Axum
Queryextractor because it cannot parse binary data. As you can read here.I could have used the RawQuery extractor, but I thought this way would be much cleaner because you can pass the
AnnounceParamsinto the handler like this:And you can also handle the errors in the extractor if you have to return a "bad request" response. Alternatively, I could have handled parsing and error handling inside the handler.