Skip to content

feat(http-protocol): rename HTTP announce peer_addr param to ip (BEP 3) - #1992

Merged
josecelano merged 4 commits into
torrust:developfrom
josecelano:1985-rename-peer-addr-to-ip-in-http-announce-request
Jul 16, 2026
Merged

feat(http-protocol): rename HTTP announce peer_addr param to ip (BEP 3)#1992
josecelano merged 4 commits into
torrust:developfrom
josecelano:1985-rename-peer-addr-to-ip-in-http-announce-request

Conversation

@josecelano

Copy link
Copy Markdown
Member

Summary

Renames the HTTP announce GET parameter from the non-standard peer_addr to the BEP 3-specified ip, aligning the wire protocol with the specification.

Closes #1985

Changes

  • Rename constant PEER_ADDRIP (value "peer_addr""ip")
  • Rename struct field Announce::peer_addrAnnounce::ip
  • Rename builder method with_peer_addrwith_ip
  • Rename extractor function extract_peer_addrextract_ip
  • Fix Display impl to use IP constant instead of hardcoded string 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 (docs/adrs/20260716_accept_only_ip_addresses_in_http_announce_ip_param.md)

Verification

  • All pre-push checks pass (nightly fmt/check/doc + stable full test suite)
  • linter all exits 0
  • Manual verification M1/M2/M3 executed against local tracker build (evidence in docs/issues/open/1985-rename-peer-addr-to-ip-in-http-announce-request/manual-verification.md):
    • M1: ip=2.137.87.41 → HTTP 200, valid announce response ✅
    • M2: peer_addr=2.137.87.41 (old name) → HTTP 200, param silently ignored ✅
    • M3: 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

…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.
Copilot AI review requested due to automatic review settings July 16, 2026 16:40
@josecelano josecelano self-assigned this Jul 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Announce model field from peer_addrip, including builder/extractor APIs and Display formatting.
  • Updates Axum HTTP server docs and contract tests to use ip= in announce URLs.
  • Updates tracker-client HTTP CLI flags/docs to use --ip / ip in 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_addrip 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.

Comment thread docs/adrs/index.md Outdated
Comment thread docs/adrs/20260716_accept_only_ip_addresses_in_http_announce_ip_param.md Outdated
Comment thread docs/issues/open/1985-rename-peer-addr-to-ip-in-http-announce-request/ISSUE.md Outdated
Comment thread packages/tracker-core/src/torrent/mod.rs
- 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
@josecelano

Copy link
Copy Markdown
Member Author

ACK e77f2e6

@josecelano
josecelano merged commit da5c4c7 into torrust:develop Jul 16, 2026
27 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename peer_addr GET param to ip in HTTP announce request (BEP 3)

2 participants