Skip to content

Commit 99f25b6

Browse files
committed
Merge #1314: Refactor packages: extract udp-tracker-server package
35c6865 refactor: remove unused code (Jose Celano) ec6b968 refactor: [#1284] extract udp-tracker-server package (Jose Celano) b071900 docs: fix crate docs URL (Jose Celano) Pull request description: Refactor packages: extract `udp-tracker-server` package ACKs for top commit: josecelano: ACK 35c6865 Tree-SHA512: 7bb0e7c919d2e2fe5918180e46d791daa95062cd803188f98101bd65f1277cdbde7279219eb8cc26ed7083e83afe306dc05bcec0db2a35f4f3960c1ba00f54ab
2 parents 8a682aa + 35c6865 commit 99f25b6

40 files changed

+843
-192
lines changed

.github/workflows/deployment.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ jobs:
7676
cargo publish -p torrust-tracker-primitives
7777
cargo publish -p torrust-tracker-test-helpers
7878
cargo publish -p torrust-tracker-torrent-repository
79+
cargo publish -p torrust-udp-tracker-server

Cargo.lock

+30-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ dashmap = "6"
5050
derive_more = { version = "2", features = ["as_ref", "constructor", "from"] }
5151
figment = "0"
5252
futures = "0"
53-
futures-util = "0"
5453
hyper = "1"
5554
parking_lot = "0"
5655
percent-encoding = "2"
@@ -60,7 +59,6 @@ r2d2_sqlite = { version = "0", features = ["bundled"] }
6059
rand = "0"
6160
regex = "1"
6261
reqwest = { version = "0", features = ["json"] }
63-
ringbuf = "0"
6462
serde = { version = "1", features = ["derive"] }
6563
serde_bencode = "0"
6664
serde_bytes = "0"
@@ -76,9 +74,9 @@ torrust-server-lib = { version = "3.0.0-develop", path = "packages/server-lib" }
7674
torrust-tracker-api-core = { version = "3.0.0-develop", path = "packages/tracker-api-core" }
7775
torrust-tracker-clock = { version = "3.0.0-develop", path = "packages/clock" }
7876
torrust-tracker-configuration = { version = "3.0.0-develop", path = "packages/configuration" }
79-
torrust-tracker-located-error = { version = "3.0.0-develop", path = "packages/located-error" }
8077
torrust-tracker-primitives = { version = "3.0.0-develop", path = "packages/primitives" }
8178
torrust-tracker-torrent-repository = { version = "3.0.0-develop", path = "packages/torrent-repository" }
79+
torrust-udp-tracker-server = { version = "3.0.0-develop", path = "packages/udp-tracker-server" }
8280
tower = { version = "0", features = ["timeout"] }
8381
tower-http = { version = "0", features = ["compression-full", "cors", "propagate-header", "request-id", "trace"] }
8482
tracing = "0"

packages/axum-http-tracker-server/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The Torrust Bittorrent HTTP tracker.
44

55
## Documentation
66

7-
[Crate documentation](https://docs.rs/torrust-axum-server).
7+
[Crate documentation](https://docs.rs/torrust-axum-http-tracker-server).
88

99
## License
1010

packages/axum-http-tracker-server/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@
238238
//! `info_hash` parameters: `info_hash=%81%00%0...00%00%00&info_hash=%82%00%0...00%00%00`
239239
//!
240240
//! > **NOTICE**: the maximum number of torrents you can scrape at the same time
241-
//! > is `74`. Defined with a hardcoded const [`MAX_SCRAPE_TORRENTS`](crate::shared::bit_torrent::common::MAX_SCRAPE_TORRENTS).
241+
//! > is `74`. Defined with a hardcoded const [`MAX_SCRAPE_TORRENTS`](torrust_udp_tracker_server::MAX_SCRAPE_TORRENTS).
242242
//!
243243
//! **Sample response**
244244
//!

packages/axum-http-tracker-server/src/v1/handlers/announce.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
//! Axum [`handlers`](axum#handlers) for the `announce` requests.
22
//!
3-
//! Refer to [HTTP server](crate::servers::http) for more information about the
4-
//! `announce` request.
5-
//!
63
//! The handlers perform the authentication and authorization of the request,
74
//! and resolve the client IP address.
85
use std::sync::Arc;

packages/axum-http-tracker-server/src/v1/handlers/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
//! Axum [`handlers`](axum#handlers) for the HTTP server.
2-
//!
3-
//! Refer to the generic [HTTP server documentation](crate::servers::http) for
4-
//! more information about the HTTP tracker.
52
pub mod announce;
63
pub mod common;
74
pub mod health_check;

packages/axum-http-tracker-server/src/v1/handlers/scrape.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
//! Axum [`handlers`](axum#handlers) for the `announce` requests.
22
//!
3-
//! Refer to [HTTP server](crate::servers::http) for more information about the
4-
//! `scrape` request.
5-
//!
63
//! The handlers perform the authentication and authorization of the request,
74
//! and resolve the client IP address.
85
use std::sync::Arc;
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
//! HTTP server implementation for the `v1` API.
2-
//!
3-
//! Refer to the generic [HTTP server documentation](crate::servers::http) for
4-
//! more information about the endpoints and their usage.
52
pub mod extractors;
63
pub mod handlers;
74
pub mod routes;

packages/tracker-core/src/lib.rs

+14
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,20 @@ pub mod peer_tests;
131131
pub mod test_helpers;
132132

133133
use torrust_tracker_clock::clock;
134+
135+
/// The maximum number of torrents that can be returned in an `scrape` response.
136+
///
137+
/// The [BEP 15. UDP Tracker Protocol for `BitTorrent`](https://www.bittorrent.org/beps/bep_0015.html)
138+
/// defines this limit:
139+
///
140+
/// "Up to about 74 torrents can be scraped at once. A full scrape can't be done
141+
/// with this protocol."
142+
///
143+
/// The [BEP 48. Tracker Protocol Extension: Scrape](https://www.bittorrent.org/beps/bep_0048.html)
144+
/// does not specifically mention this limit, but the limit is being used for
145+
/// both the UDP and HTTP trackers since it's applied at the domain level.
146+
pub const MAX_SCRAPE_TORRENTS: u8 = 74;
147+
134148
/// This code needs to be copied into each crate.
135149
/// Working version, for production.
136150
#[cfg(not(test))]
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[package]
2+
authors.workspace = true
3+
description = "The Torrust Bittorrent UDP tracker."
4+
documentation.workspace = true
5+
edition.workspace = true
6+
homepage.workspace = true
7+
keywords = ["axum", "bittorrent", "server", "torrust", "tracker", "udp"]
8+
license.workspace = true
9+
name = "torrust-udp-tracker-server"
10+
publish.workspace = true
11+
readme = "README.md"
12+
repository.workspace = true
13+
rust-version.workspace = true
14+
version.workspace = true
15+
16+
[dependencies]
17+
aquatic_udp_protocol = "0"
18+
bittorrent-primitives = "0.1.0"
19+
bittorrent-tracker-client = { version = "3.0.0-develop", path = "../tracker-client" }
20+
bittorrent-tracker-core = { version = "3.0.0-develop", path = "../tracker-core" }
21+
bittorrent-udp-tracker-core = { version = "3.0.0-develop", path = "../udp-tracker-core" }
22+
derive_more = { version = "2", features = ["as_ref", "constructor", "from"] }
23+
futures = "0"
24+
futures-util = "0"
25+
ringbuf = "0"
26+
thiserror = "2"
27+
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "signal", "sync"] }
28+
torrust-server-lib = { version = "3.0.0-develop", path = "../server-lib" }
29+
torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" }
30+
torrust-tracker-configuration = { version = "3.0.0-develop", path = "../configuration" }
31+
torrust-tracker-located-error = { version = "3.0.0-develop", path = "../located-error" }
32+
torrust-tracker-primitives = { version = "3.0.0-develop", path = "../primitives" }
33+
tracing = "0"
34+
url = { version = "2", features = ["serde"] }
35+
uuid = { version = "1", features = ["v4"] }
36+
zerocopy = "0.7"
37+
38+
[dev-dependencies]
39+
local-ip-address = "0"
40+
mockall = "0"
41+
torrust-tracker-test-helpers = { version = "3.0.0-develop", path = "../test-helpers" }

0 commit comments

Comments
 (0)