feat(http-protocol): rename HTTP announce peer_addr param to ip (BEP 3) - #1992
Merged
josecelano merged 4 commits intoJul 16, 2026
Conversation
…BEP 3) Align the HTTP tracker wire protocol with BEP 3 by renaming the non-standard `peer_addr` GET parameter to the spec-defined `ip`. Changes: - Rename constant `PEER_ADDR` → `IP` (value "peer_addr" → "ip") - Rename struct field `Announce::peer_addr` → `Announce::ip` - Rename builder method `with_peer_addr` → `with_ip` - Rename extractor function `extract_peer_addr` → `extract_ip` - Fix `Display` impl to use `IP` constant instead of hardcoded literal - Replace incorrect NOTICE (BEP 15 reference) in axum-http-server docs with correct BEP 3 description - Update all sample URLs from `peer_addr=` to `ip=` - Update test fixtures, integration tests, and inline test query strings - Rename CLI flag `--peer-addr` → `--ip` in tracker-client binaries - Update tracker-client JSON request-input docs - Add ADR: accept only IP addresses (not DNS names) in announce `ip` param Closes torrust#1985
Run M1/M2/M3 scenarios against local tracker build: - M1: ip=2.137.87.41 → HTTP 200, valid announce response ✅ - M2: peer_addr=2.137.87.41 → HTTP 200, param ignored ✅ - M3: ip=hostname.example.com → HTTP 200, DNS name silently ignored ✅ Evidence recorded in manual-verification.md. Update ISSUE.md: mark manual verification checkpoint done and log entry.
There was a problem hiding this comment.
Pull request overview
This PR aligns the HTTP announce wire protocol with BEP 3 by renaming the non-standard peer_addr query parameter to ip, and propagates that rename through the HTTP protocol layer, server contract tests, tracker-client CLI/docs, and project documentation.
Changes:
- Renames the HTTP announce query parameter constant and
Announcemodel field frompeer_addr→ip, including builder/extractor APIs andDisplayformatting. - Updates Axum HTTP server docs and contract tests to use
ip=in announce URLs. - Updates tracker-client HTTP CLI flags/docs to use
--ip/ipin JSON request input, and adds ADR + manual verification evidence for the “IP-only” parsing policy.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/tracker-core/src/torrent/mod.rs | Updates sample HTTP announce URL to use ip=. |
| packages/http-protocol/src/v1/requests/announce.rs | Renames peer_addr → ip throughout the HTTP announce request model (constants, struct field, builder, extractor, display, tests). |
| packages/http-core/src/services/announce.rs | Updates tests/fixtures constructing Announce to use ip. |
| packages/http-core/benches/helpers/util.rs | Updates benchmark helper announce request construction to use ip. |
| packages/axum-http-server/tests/server/v1/contract/for_all_config_modes/receiving_an_announce_request.rs | Updates contract tests and helper usage to build announce URLs and queries using ip. |
| packages/axum-http-server/tests/server/v1/contract/configured_as_private.rs | Updates private-mode contract test URL to use ip=. |
| packages/axum-http-server/src/v1/handlers/announce.rs | Updates handler tests/fixtures to use ip. |
| packages/axum-http-server/src/v1/extractors/announce_request.rs | Updates extractor docs and inline tests to use ip= and parse into Announce::ip. |
| packages/axum-http-server/src/lib.rs | Updates HTTP tracker documentation parameter table and NOTICE text to reference BEP 3 ip. |
| docs/issues/open/1985-rename-peer-addr-to-ip-in-http-announce-request/manual-verification.md | Adds manual verification evidence (M1/M2/M3) for valid IP, legacy param ignored, and DNS ignored. |
| docs/issues/open/1985-rename-peer-addr-to-ip-in-http-announce-request/ISSUE.md | Marks tasks/acceptance criteria as done and links verification evidence. |
| docs/adrs/index.md | Adds ADR index entry for the “IP-only” policy decision. |
| docs/adrs/20260716_accept_only_ip_addresses_in_http_announce_ip_param.md | Adds ADR documenting the “accept only IP addresses” policy for HTTP announce ip. |
| console/tracker-client/src/console/clients/unified/http.rs | Renames CLI flag/option from --peer-addr to --ip and uses with_ip. |
| console/tracker-client/src/console/clients/http/app.rs | Renames CLI flag/option from --peer-addr to --ip and uses with_ip. |
| console/tracker-client/docs/features/json-request-input/README.md | Updates JSON request input example and notes to use ip. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Rename ADR file from 8-digit to 14-digit prefix (YYYYMMDDHHMMSS) per docs/adrs/README.md convention - Add YAML frontmatter to ADR; remove Status: Accepted header (not used in this project per ADR lifecycle docs) - Fix missed peer_addr= sample URL in src/lib.rs doc comment - Mark remaining acceptance criteria checkboxes as done in ISSUE.md
Member
Author
|
ACK e77f2e6 |
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
Renames the HTTP announce GET parameter from the non-standard
peer_addrto the BEP 3-specifiedip, aligning the wire protocol with the specification.Closes #1985
Changes
PEER_ADDR→IP(value"peer_addr"→"ip")Announce::peer_addr→Announce::ipwith_peer_addr→with_ipextract_peer_addr→extract_ipDisplayimpl to useIPconstant instead of hardcoded string literalaxum-http-serverdocs with correct BEP 3 descriptionpeer_addr=toip=--peer-addr→--ipin tracker-client binariesipparam (docs/adrs/20260716_accept_only_ip_addresses_in_http_announce_ip_param.md)Verification
linter allexits 0docs/issues/open/1985-rename-peer-addr-to-ip-in-http-announce-request/manual-verification.md):ip=2.137.87.41→ HTTP 200, valid announce response ✅peer_addr=2.137.87.41(old name) → HTTP 200, param silently ignored ✅ip=hostname.example.com(DNS) → HTTP 200, silently ignored ✅Spec
docs/issues/open/1985-rename-peer-addr-to-ip-in-http-announce-request/ISSUE.md