feat(tracker-client): add optional announce params to HTTP client#1739
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the HTTP tracker client’s announce command to accept optional announce parameters (event/counters/peer identity/compact mode) and threads them into the HTTP announce query builder while keeping existing defaults. It also updates response handling to decode both dictionary and compact announce responses, and documents manual verification and learnings for issue #1532.
Changes:
- Add missing
QueryBuildersetters forevent,uploaded,downloaded,left, andport. - Extend the HTTP tracker client CLI to accept optional announce flags (including CLI-facing enums for
eventandcompact) and apply them to the query. - Support decoding both dictionary and compact announce responses, and update the issue spec with verification notes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/tracker-client/src/http/client/requests/announce.rs | Adds additional QueryBuilder setters for optional announce parameters. |
| console/tracker-client/src/console/clients/http/app.rs | Adds optional CLI flags for announce, maps them into the request builder, and decodes compact vs dictionary responses. |
| docs/issues/1532-http-tracker-client-add-optional-announce-params.md | Updates the issue spec with completed checklist items, corrected examples, and manual verification/learnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
ACK 40e9b65 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1739 +/- ##
===========================================
- Coverage 79.57% 79.45% -0.13%
===========================================
Files 368 368
Lines 27078 27117 +39
Branches 27078 27117 +39
===========================================
- Hits 21548 21546 -2
- Misses 5248 5290 +42
+ Partials 282 281 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Feature Example
Command:
cargo run -p torrust-tracker-client --bin http_tracker_client announce \ http://127.0.0.1:7070 2222222222222222222222222222222222222222 \ --event completed \ --uploaded 1000 \ --downloaded 1000 \ --left 0 \ --port 6881 \ --peer-addr 10.0.0.1 \ '--peer-id=-RC00000000000000001' \ --compact 1Observed output:
{"complete":1,"incomplete":0,"interval":120,"min interval":120,"peers":[]}Observed follow-up verification:
{"complete":0,"downloaded":0,"incomplete":1}to{"complete":1,"downloaded":1,"incomplete":0}seeders=0, completed=1, leechers=1toseeders=1, completed=2, leechers=0Edge-Case Checks
peer-id must be exactly 20 bytesstarted,stopped,completed0,1invalid IP address syntax--port 0now fails withport must be greater than zero--peer-id=-RC...form to avoid clap parsing-Ras another flagValidation
Related