feat(tracker-client): add optional announce parameters to UDP tracker client#1738
Merged
josecelano merged 9 commits intoMay 7, 2026
Conversation
… client Add optional CLI flags to the UDP tracker client's announce command: - --event (none|completed|started|stopped) - --uploaded (bytes) - --downloaded (bytes) - --left (bytes) - --port (number) - --ip-address (IPv4) - --peer-id (20 bytes) - --key (integer) - --peers-wanted (integer) When flags are omitted, hard-coded defaults are preserved (backward compatible). Implementation: - Add CliAnnounceEvent wrapper enum for clap parsing (ValueEnum) - Add AnnounceParams struct to thread optional values through layers - Update send_announce_request() to accept and apply parameter overrides - Add parse_peer_id() validator for 20-byte requirement - Thread params from CLI through handle_announce() to client - Update module doc with extended usage examples Validation: - Uploaded/downloaded/left typed as u64 (clap rejects negatives) - Peer-id validated as exactly 20 bytes at CLI layer - Event values validated against enum Fixes torrust#1533
There was a problem hiding this comment.
Pull request overview
This PR extends the UDP tracker client CLI so developers can override announce request fields (event and other announce parameters) without recompiling, while keeping existing defaults when flags are omitted.
Changes:
- Add optional
announceCLI flags (event/uploaded/downloaded/left/port/ip/peer-id/key/peers-wanted) and thread them into the UDP announce request builder. - Introduce a CLI-only
CliAnnounceEvent(clap::ValueEnum) mapped to the protocolAnnounceEvent, plus peer-id length (20 bytes) validation. - Add/update supporting documentation (manual verification steps, deferred JSON-input proposal, and a “run tracker locally” skill), and update the project word list.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| project-words.txt | Adds spellchecker allow-list entries for new docs/terms. |
| docs/issues/1533-udp-tracker-client-add-optional-announce-params.md | Marks goals as completed and adds a manual verification section for UDP announce params. |
| docs/issues/1532-http-tracker-client-add-optional-announce-params.md | Adds a manual verification test plan section for the HTTP client (future work). |
| console/tracker-client/src/console/clients/udp/checker.rs | Adds AnnounceParams and applies optional overrides when building UDP announce requests. |
| console/tracker-client/src/console/clients/udp/app.rs | Extends UDP client CLI parsing to accept optional announce params and validates peer-id length. |
| console/tracker-client/src/console/clients/checker/checks/udp.rs | Updates checker to call the new announce API with default params. |
| console/tracker-client/docs/features/json-request-input/README.md | Adds deferred proposal doc for JSON/file/stdin request input mode. |
| .github/skills/dev/environment-setup/run-tracker-locally/SKILL.md | Adds a skill doc describing how to run and verify the tracker locally. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #1738 +/- ##
===========================================
- Coverage 79.63% 79.58% -0.06%
===========================================
Files 368 368
Lines 27057 27078 +21
Branches 27057 27078 +21
===========================================
+ Hits 21548 21549 +1
- Misses 5227 5248 +21
+ Partials 282 281 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
|
ACK e8d5edd |
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.
Summary
Feature Example
Command:
cargo run -p torrust-tracker-client --bin udp_tracker_client announce \ 127.0.0.1:6969 443c7602b4fde83d1154d6d9da48808418b181b6 \ --event completed \ --uploaded 1234 \ --downloaded 5678 \ --left 0 \ --port 6881 \ --ip-address 10.0.0.1 \ '--peer-id=-RC00000000000000001' \ --key 42 \ --peers-wanted 50Example output:
{ "AnnounceIpv4": { "transaction_id": -888840697, "announce_interval": 120, "leechers": 0, "seeders": 1, "peers": [] } }Validation
Related