Skip to content

Commit 569b222

Browse files
committed
Merge #1045: Release Version 3.0.0-rc.1
beb56d3 release: version 3.0.0-rc.1 (Jose Celano) bdb0419 chore(deps): update dependencies (Jose Celano) faee02f feat: [#675] tracker checker (HTTP tracker) supports more service address formats (Jose Celano) 520026d feat: [#675] tracker checker supports more service address formats (Jose Celano) dbee825 fix: [#1037] wrong req type name in tracker checker outout (Jose Celano) c49438f fix: remove debugging print (Jose Celano) 084879e feat: [#569] numwant HTTP tracker announce param (Jose Celano) 481d413 feat: [#569] allow UDP clients to limit peers in response (Jose Celano) ff836ed fix: clippy error (Jose Celano) 1f64cc9 chore(deps): udpate dependencies (Jose Celano) b88cc61 develop: bump to version 3.0.0-rc.1-develop (Jose Celano) Pull request description: Release Version 3.0.0-rc.1 ACKs for top commit: josecelano: ACK beb56d3 Tree-SHA512: fb923cb93948123fe4af4f144aaedd72f33aabde1428aac5f14d15eec3b0779b0663c6b1e2580e32c920e343529d1bdbd472b4a1f58592126bb12188bfe4ae7a
2 parents e254e76 + beb56d3 commit 569b222

File tree

20 files changed

+751
-577
lines changed

20 files changed

+751
-577
lines changed

Cargo.lock

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

Cargo.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ license = "AGPL-3.0-only"
2727
publish = true
2828
repository = "https://github.com/torrust/torrust-tracker"
2929
rust-version = "1.72"
30-
version = "3.0.0-beta"
30+
version = "3.0.0-rc.1"
3131

3232
[dependencies]
3333
anyhow = "1"
@@ -69,12 +69,12 @@ serde_repr = "0"
6969
serde_with = { version = "3", features = ["json"] }
7070
thiserror = "1"
7171
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "signal", "sync"] }
72-
torrust-tracker-clock = { version = "3.0.0-beta", path = "packages/clock" }
73-
torrust-tracker-configuration = { version = "3.0.0-beta", path = "packages/configuration" }
74-
torrust-tracker-contrib-bencode = { version = "3.0.0-beta", path = "contrib/bencode" }
75-
torrust-tracker-located-error = { version = "3.0.0-beta", path = "packages/located-error" }
76-
torrust-tracker-primitives = { version = "3.0.0-beta", path = "packages/primitives" }
77-
torrust-tracker-torrent-repository = { version = "3.0.0-beta", path = "packages/torrent-repository" }
72+
torrust-tracker-clock = { version = "3.0.0-rc.1", path = "packages/clock" }
73+
torrust-tracker-configuration = { version = "3.0.0-rc.1", path = "packages/configuration" }
74+
torrust-tracker-contrib-bencode = { version = "3.0.0-rc.1", path = "contrib/bencode" }
75+
torrust-tracker-located-error = { version = "3.0.0-rc.1", path = "packages/located-error" }
76+
torrust-tracker-primitives = { version = "3.0.0-rc.1", path = "packages/primitives" }
77+
torrust-tracker-torrent-repository = { version = "3.0.0-rc.1", path = "packages/torrent-repository" }
7878
tower = { version = "0", features = ["timeout"] }
7979
tower-http = { version = "0", features = ["compression-full", "cors", "propagate-header", "request-id", "trace"] }
8080
trace = "0"
@@ -90,7 +90,7 @@ ignored = ["crossbeam-skiplist", "dashmap", "figment", "parking_lot", "serde_byt
9090
[dev-dependencies]
9191
local-ip-address = "0"
9292
mockall = "0"
93-
torrust-tracker-test-helpers = { version = "3.0.0-beta", path = "packages/test-helpers" }
93+
torrust-tracker-test-helpers = { version = "3.0.0-rc.1", path = "packages/test-helpers" }
9494

9595
[workspace]
9696
members = [

packages/clock/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ version.workspace = true
1919
chrono = { version = "0", default-features = false, features = ["clock"] }
2020
lazy_static = "1"
2121

22-
torrust-tracker-primitives = { version = "3.0.0-beta", path = "../primitives" }
22+
torrust-tracker-primitives = { version = "3.0.0-rc.1", path = "../primitives" }
2323

2424
[dev-dependencies]

packages/clock/src/conv/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use chrono::{DateTime, Utc};
44
use torrust_tracker_primitives::DurationSinceUnixEpoch;
55

66
/// It converts a string in ISO 8601 format to a timestamp.
7+
///
78
/// For example, the string `1970-01-01T00:00:00.000Z` which is the Unix Epoch
89
/// will be converted to a timestamp of 0: `DurationSinceUnixEpoch::ZERO`.
910
///

packages/configuration/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ serde_json = { version = "1", features = ["preserve_order"] }
2323
serde_with = "3"
2424
thiserror = "1"
2525
toml = "0"
26-
torrust-tracker-located-error = { version = "3.0.0-beta", path = "../located-error" }
26+
torrust-tracker-located-error = { version = "3.0.0-rc.1", path = "../located-error" }
2727
url = "2"
2828

2929
[dev-dependencies]

packages/test-helpers/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ version.workspace = true
1616

1717
[dependencies]
1818
rand = "0"
19-
torrust-tracker-configuration = { version = "3.0.0-beta", path = "../configuration" }
19+
torrust-tracker-configuration = { version = "3.0.0-rc.1", path = "../configuration" }

packages/torrent-repository/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ dashmap = "6"
2222
futures = "0"
2323
parking_lot = "0"
2424
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "signal", "sync"] }
25-
torrust-tracker-clock = { version = "3.0.0-beta", path = "../clock" }
26-
torrust-tracker-configuration = { version = "3.0.0-beta", path = "../configuration" }
27-
torrust-tracker-primitives = { version = "3.0.0-beta", path = "../primitives" }
25+
torrust-tracker-clock = { version = "3.0.0-rc.1", path = "../clock" }
26+
torrust-tracker-configuration = { version = "3.0.0-rc.1", path = "../configuration" }
27+
torrust-tracker-primitives = { version = "3.0.0-rc.1", path = "../primitives" }
2828
zerocopy = "0"
2929

3030
[dev-dependencies]

src/console/clients/checker/checks/http.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,24 @@ pub async fn run(http_trackers: Vec<Url>, timeout: Duration) -> Vec<Result<Check
2828
tracing::debug!("HTTP trackers ...");
2929

3030
for ref url in http_trackers {
31+
let mut base_url = url.clone();
32+
base_url.set_path("");
33+
3134
let mut checks = Checks {
3235
url: url.clone(),
3336
results: Vec::default(),
3437
};
3538

3639
// Announce
3740
{
38-
let check = check_http_announce(url, timeout).await.map(|_| ());
41+
let check = check_http_announce(&base_url, timeout).await.map(|_| ());
3942

4043
checks.results.push((Check::Announce, check));
4144
}
4245

4346
// Scrape
4447
{
45-
let check = check_http_scrape(url, timeout).await.map(|_| ());
48+
let check = check_http_scrape(&base_url, timeout).await.map(|_| ());
4649

4750
checks.results.push((Check::Scrape, check));
4851
}

src/console/clients/checker/checks/udp.rs

+41-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::time::Duration;
44
use aquatic_udp_protocol::TransactionId;
55
use hex_literal::hex;
66
use serde::Serialize;
7+
use url::Url;
78

89
use crate::console::clients::udp::checker::Client;
910
use crate::console::clients::udp::Error;
@@ -23,20 +24,22 @@ pub enum Check {
2324
}
2425

2526
#[allow(clippy::missing_panics_doc)]
26-
pub async fn run(udp_trackers: Vec<SocketAddr>, timeout: Duration) -> Vec<Result<Checks, Checks>> {
27+
pub async fn run(udp_trackers: Vec<Url>, timeout: Duration) -> Vec<Result<Checks, Checks>> {
2728
let mut results = Vec::default();
2829

2930
tracing::debug!("UDP trackers ...");
3031

3132
let info_hash = aquatic_udp_protocol::InfoHash(hex!("9c38422213e30bff212b30c360d26f9a02136422")); // # DevSkim: ignore DS173237
3233

33-
for remote_addr in udp_trackers {
34+
for remote_url in udp_trackers {
35+
let remote_addr = resolve_socket_addr(&remote_url);
36+
3437
let mut checks = Checks {
3538
remote_addr,
3639
results: Vec::default(),
3740
};
3841

39-
tracing::debug!("UDP tracker: {:?}", remote_addr);
42+
tracing::debug!("UDP tracker: {:?}", remote_url);
4043

4144
// Setup
4245
let client = match Client::new(remote_addr, timeout).await {
@@ -83,7 +86,7 @@ pub async fn run(udp_trackers: Vec<SocketAddr>, timeout: Duration) -> Vec<Result
8386
.await
8487
.map(|_| ());
8588

86-
checks.results.push((Check::Announce, check));
89+
checks.results.push((Check::Scrape, check));
8790
}
8891

8992
if checks.results.iter().any(|f| f.1.is_err()) {
@@ -95,3 +98,37 @@ pub async fn run(udp_trackers: Vec<SocketAddr>, timeout: Duration) -> Vec<Result
9598

9699
results
97100
}
101+
102+
fn resolve_socket_addr(url: &Url) -> SocketAddr {
103+
let socket_addr = url.socket_addrs(|| None).unwrap();
104+
*socket_addr.first().unwrap()
105+
}
106+
107+
#[cfg(test)]
108+
mod tests {
109+
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
110+
111+
use url::Url;
112+
113+
use crate::console::clients::checker::checks::udp::resolve_socket_addr;
114+
115+
#[test]
116+
fn it_should_resolve_the_socket_address_for_udp_scheme_urls_containing_a_domain() {
117+
let socket_addr = resolve_socket_addr(&Url::parse("udp://localhost:8080").unwrap());
118+
119+
assert!(
120+
socket_addr == SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080)
121+
|| socket_addr == SocketAddr::new(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8080)
122+
);
123+
}
124+
125+
#[test]
126+
fn it_should_resolve_the_socket_address_for_udp_scheme_urls_containing_an_ip() {
127+
let socket_addr = resolve_socket_addr(&Url::parse("udp://localhost:8080").unwrap());
128+
129+
assert!(
130+
socket_addr == SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080)
131+
|| socket_addr == SocketAddr::new(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8080)
132+
);
133+
}
134+
}

0 commit comments

Comments
 (0)