Skip to content

Axum HTTP tracker: Compact announce response in public mode in Axum#1

Closed
josecelano wants to merge 6 commits into
issue-184-axum-hhtp-tracker-announce-req-public-modefrom
issue-187-axum-http-tracker-compact-announce-req-public-mode
Closed

Axum HTTP tracker: Compact announce response in public mode in Axum#1
josecelano wants to merge 6 commits into
issue-184-axum-hhtp-tracker-announce-req-public-modefrom
issue-187-axum-http-tracker-compact-announce-req-public-mode

Conversation

@josecelano

@josecelano josecelano commented Feb 17, 2023

Copy link
Copy Markdown
Owner

Implementation for the compact announce response in the Axum HTTP tracker.

da638d6 docs(http): fix extractor docs (Jose Celano)
30918da refactor(http): [torrust#184] move extractor to extractor mod (Jose Celano)
99dbbe4 refactor(http): [torrust#184] extract announce service in Axum tracker (Jose Celano)
02e2516 feat(http): [torrust#184] Axum extractor for peer IP (Jose Celano)
74ed592 feat(http): [torrust#184] added optional params to announce req in Axum implementation (Jose Celano)
b1612f6 test(http): improve tests (Jose Celano)
3eb7475 feat(http): [torrust#184] normal (non-compact) announce response in axum tracker (Jose Celano)
42bd313 feat: [torrust#184] calculate remote client ip depending on whether the tracker is running on reverse proxy or not (Jose Celano)
8318057 feat: [torrust#184] add dependency: axum-client-ip (Jose Celano)
f327dcf fix(http): [torrust#184] bencoded error responses for announce request (Jose Celano)
d0c8eb0 refactor(http): reorganize mods (Jose Celano)
03024e2 refactor(http): extract function to get client IP on reverse proxy (Jose Celano)

Pull request description:

  It implements the `announce` request handler in the Axum HTTP tracker for `public` mode.

  - [x] Normal (non-compact) response with only mandatory params
  - [x] Optional params for `announce` request
  - [x] Return bencoded error when remote client IP cannot be obtained from the `X-Forwarded-For` header on reverse proxy mode. See commented tests.
  - [x] Refactor: extract service for handler body.

  Out of this PR scope:

  - [ ] Capture unexpected handler errors and convert them into bencoded generic HTTP tracker response errors. Moved to [parent issue](torrust#160).
  - [ ] Compact response.

  **UPDATE**: 16/02/2023

Top commit has no ACKs.

Tree-SHA512: 76f77ed87f64ff6a488090e9013d92cbc516135a770206408a38bcba1c57ceb01154cd87b7169ed01ee12791c12d5e991ab59c4e53ba7c164a146292d6a94677
@josecelano
josecelano force-pushed the issue-187-axum-http-tracker-compact-announce-req-public-mode branch from 1445d0b to db21e6d Compare February 20, 2023 07:48
@josecelano
josecelano force-pushed the issue-187-axum-http-tracker-compact-announce-req-public-mode branch 2 times, most recently from d595151 to eed4348 Compare February 20, 2023 17:52
It will be used to build the bencoded compact annouce response in the
HTTP tracker. We are currently writting directly bytes into a byte
buffer, but Bencode specification imposes some restrictions like:

The keys in a dictionary must me alphabetically orderded. We are not
doing that in the current implementation.
- Remove extra byte "e" between "peer" and "peer6" dictionary keys.
- Alphabetically order dictionary keys.
Those test should have been enabled when the implementation was done.
…ut a different port

Other refactores were made to improve funtions names.

BREAKING CHANGE: before this a peer with the same IP as the client that
is making the announce request was removed from the announce response
regardless whether they have the same IP or not.
@josecelano
josecelano force-pushed the issue-187-axum-http-tracker-compact-announce-req-public-mode branch from eed4348 to 5020722 Compare February 20, 2023 18:36
@josecelano

Copy link
Copy Markdown
Owner Author

torrust#190

@josecelano josecelano closed this Feb 21, 2023
josecelano added a commit that referenced this pull request Apr 30, 2026
Replace the fixed 10-iteration yield_now() loop in it_should_persist_the_number_of_completed_peers_for_each_torrent_into_the_database with a tokio::time::timeout(5s, ...) wrapper plus a 50 ms sleep between attempts. The test now fails loudly on a stalled system rather than silently after an arbitrary burst of immediate retries.

Addresses Copilot review item #1 on PR torrust#1718.
josecelano added a commit that referenced this pull request Jul 20, 2026
…t#1979)

Subissue #1 of EPIC torrust#1978 — Configuration Overhaul (schema v3.0.0).

- Copy `packages/configuration/src/v2_0_0/` to `v3_0_0/` as the
  starting point for all breaking changes
- Update all internal `v2_0_0` references in `v3_0_0/` to `v3_0_0`
  (doc links, VERSION constant, test imports, schema_version strings)
- Merge the crate-root `logging.rs` behaviour (TraceStyle, setup,
  tracing_init) into both `v2_0_0/logging.rs` and `v3_0_0/logging.rs`,
  making each versioned module fully self-contained
- Add `pub mod v3_0_0` to `lib.rs` alongside `pub mod v2_0_0`
- Add `Metadata::with_schema_version` helper constructor to `lib.rs`
- Add `v3_0_0::Configuration::Default` impl that sets schema version
  to "3.0.0" explicitly
- Add smoke tests: v3 loads "3.0.0" configs and rejects "2.0.0" configs
- Global re-exports and default config files stay at v2 until the final
  cleanup subissue torrust#1980 switches all consumers atomically

T6 (update default config files) and T7 (wire bootstrap to v3) are
deferred to torrust#1980: the bootstrap uses the global `Configuration`
re-export (= v2_0_0) and cannot be switched without migrating all
consumers at once.

All 48 test suites pass; `linter all` exits 0.

Closes torrust#1979
josecelano added a commit that referenced this pull request Jul 20, 2026
… as baseline (torrust#1979)

2b6bc1a fix(configuration): address Copilot review comments on PR torrust#1999 (Jose Celano)
cd786f1 chore(issue-1979): set related-pr to 1999 in spec (Jose Celano)
cce0aba feat(configuration): copy v2_0_0 schema to v3_0_0 as baseline (torrust#1979) (Jose Celano)

Pull request description:

  ## Summary

  Subissue #1 of 9 in EPIC torrust#1978 — Configuration Overhaul (schema v3.0.0).

  This is the **foundation PR**: all other subissues in the EPIC depend on this being merged first.

  ## What this PR does

  - Copies `packages/configuration/src/v2_0_0/` → `v3_0_0/` as the clean baseline for all v3 breaking changes
  - Updates all internal `v2_0_0` references inside `v3_0_0/` (doc links, `VERSION` constant, test imports, schema version strings in test fixtures)
  - Merges the crate-root `logging.rs` behaviour (`TraceStyle`, `setup()`, `tracing_init()`) into both `v2_0_0/logging.rs` and `v3_0_0/logging.rs`, making each versioned module fully self-contained
  - Adds `pub mod v3_0_0` to `lib.rs` alongside `pub mod v2_0_0`
  - Adds `Metadata::with_schema_version` helper constructor to `lib.rs`
  - Adds an explicit `Default` impl for `v3_0_0::Configuration` that sets `schema_version = "3.0.0"`
  - Adds smoke tests: v3 parser accepts `"3.0.0"` configs and rejects `"2.0.0"` configs

  ## What is intentionally NOT done here

  Global re-exports (`pub type Configuration = v2_0_0::Configuration`, etc.) and default config files **stay at v2** until subissue torrust#1980 (final cleanup), when all consumers are migrated atomically. Doing it now would require touching ~30 consumer files and tangle subsequent subissues (#2torrust#8) that are still modifying the v3 types.

  AC3 (application uses v3 by default) and AC5 (config files reference `"3.0.0"`) are explicitly deferred to torrust#1980.

  ## Verification

  - `linter all` → ✅ passed
  - `cargo test --doc --workspace` → ✅ passed
  - Full workspace test suite (48 suites) → ✅ 0 failures
  - Pre-commit hook passed automatically on commit

  ## Related

  - EPIC: torrust#1978
  - Spec: `docs/issues/open/1979-1978-copy-configuration-schema-v2-to-v3-baseline.md`
  - Next subissue: torrust#1981 (fix `tsl_config` → `tls_config` typo)

ACKs for top commit:
  josecelano:
    ACK 2b6bc1a

Tree-SHA512: 214123e9575668e469cfeeb912cf48c1bd46a2764c24a5ab86c017f1438409da5932d80a74fafc48df781db4ca036d861b997e6717391754c6b67d7ddda811e3
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.

1 participant