feat(tracker-client): change default peer ID prefix from qB to RC#1761
Merged
josecelano merged 2 commits intoMay 12, 2026
Conversation
Replace the hard-coded qBittorrent peer ID (`-qB00000000000000001`) in all tracker-client defaults with a Torrust-specific Azureus-style peer ID: - Add `packages/tracker-client/src/peer_id.rs` with: - `DEFAULT_TEST_PEER_ID` — deterministic constant for tests/fixtures - `default_production_peer_id()` — once-per-process randomized suffix via OnceLock - Wire production helper into HTTP QueryBuilder and UDP checker defaults - Update protocol doc examples and test fixtures to use `-RC3000-` convention - Update top-level doc example announce URL - Add ADR 20260512102000 documenting the RC prefix, version field convention, test determinism policy, and package-decoupling rule Closes torrust#1564
There was a problem hiding this comment.
Pull request overview
This PR updates bittorrent-tracker-client defaults to stop advertising a qBittorrent-style peer ID and instead use a Torrust-specific Azureus-style peer ID with the -RC3000- prefix, updating affected docs and fixtures across the workspace.
Changes:
- Added
packages/tracker-client/src/peer_id.rsto centralize deterministic test peer IDs and a cached per-process production default. - Wired the new production peer ID generator into the HTTP announce default query builder and the UDP checker client.
- Updated protocol docs/tests and repository documentation/ADR to reflect the new
-RC3000-...convention.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/lib.rs |
Updates top-level announce URL documentation example to use -RC3000-.... |
packages/tracker-client/src/peer_id.rs |
Introduces peer ID constants and per-process default peer ID generation. |
packages/tracker-client/src/lib.rs |
Exposes the new peer_id module. |
packages/tracker-client/src/http/client/requests/announce.rs |
Uses the production default peer ID in QueryBuilder::with_default_values. |
packages/http-protocol/src/v1/responses/announce.rs |
Updates doc/test fixtures to the new -RC3000-... peer IDs. |
packages/http-protocol/src/v1/requests/announce.rs |
Updates doc/test fixtures to the new -RC3000-... peer IDs. |
packages/http-protocol/src/v1/query.rs |
Updates query parsing tests to the new peer ID string. |
docs/issues/open/1564-tracker-client-change-default-peer-id.md |
Marks implementation tasks as completed and adds evidence. |
docs/adrs/index.md |
Adds ADR index entry for the peer ID convention. |
docs/adrs/20260512102000_define_tracker_client_peer_id_convention.md |
Documents the new peer ID convention and policies. |
console/tracker-client/src/console/clients/udp/checker.rs |
Uses the production default peer ID when none is provided. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…onvention Address Copilot PR review suggestions on torrust#1761: - Fix doc comments in `peer_id.rs`: 'random-12-bytes' and '12-byte suffix' changed to '12-digit' to match the actual ASCII decimal implementation. - Fix ADR layout field: '12-byte-suffix' changed to '12-digit-suffix'. - Replace `.expect()` panic in `random_suffix_12_digits()` with `.unwrap_or_default()` so a misconfigured system clock (before UNIX_EPOCH) falls back to 0 nanoseconds rather than crashing the process.
Member
Author
|
ACK 49b1e5a |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1761 +/- ##
========================================
Coverage 79.44% 79.44%
========================================
Files 368 369 +1
Lines 27302 27328 +26
Branches 27302 27328 +26
========================================
+ Hits 21689 21711 +22
- Misses 5333 5337 +4
Partials 280 280 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Replaces the hard-coded qBittorrent peer ID (
-qB00000000000000001) usedin all tracker-client defaults with a Torrust-specific Azureus-style peer ID
using the
RC(Rust Client) prefix.Changes:
packages/tracker-client/src/peer_id.rswith:DEFAULT_TEST_PEER_ID— deterministic constant for tests and fixturesdefault_production_peer_id()— once-per-process randomized suffix viaOnceLockQueryBuilder::with_default_values(HTTP client) and UDP checker-RC3000-convention20260512102000documenting the RC prefix, version field convention (3000for v3.0.0),test determinism policy, and package-decoupling rule
Issue spec:
docs/issues/open/1564-tracker-client-change-default-peer-id.mdCloses: #1564
Parent EPIC: #669
Validation
linter allpassescargo machete— no unused dependenciescargo test -p bittorrent-tracker-clientcargo test -p torrust-tracker-clientcargo test -p bittorrent-http-tracker-protocol./contrib/dev-tools/git/hooks/pre-commit.sh— all checks pass