Skip to content

Commit

Permalink
Merge #1045: Release Version 3.0.0-rc.1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
josecelano committed Sep 23, 2024
2 parents e254e76 + beb56d3 commit 569b222
Show file tree
Hide file tree
Showing 20 changed files with 751 additions and 577 deletions.
732 changes: 252 additions & 480 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ license = "AGPL-3.0-only"
publish = true
repository = "https://github.com/torrust/torrust-tracker"
rust-version = "1.72"
version = "3.0.0-beta"
version = "3.0.0-rc.1"

[dependencies]
anyhow = "1"
Expand Down Expand Up @@ -69,12 +69,12 @@ serde_repr = "0"
serde_with = { version = "3", features = ["json"] }
thiserror = "1"
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "signal", "sync"] }
torrust-tracker-clock = { version = "3.0.0-beta", path = "packages/clock" }
torrust-tracker-configuration = { version = "3.0.0-beta", path = "packages/configuration" }
torrust-tracker-contrib-bencode = { version = "3.0.0-beta", path = "contrib/bencode" }
torrust-tracker-located-error = { version = "3.0.0-beta", path = "packages/located-error" }
torrust-tracker-primitives = { version = "3.0.0-beta", path = "packages/primitives" }
torrust-tracker-torrent-repository = { version = "3.0.0-beta", path = "packages/torrent-repository" }
torrust-tracker-clock = { version = "3.0.0-rc.1", path = "packages/clock" }
torrust-tracker-configuration = { version = "3.0.0-rc.1", path = "packages/configuration" }
torrust-tracker-contrib-bencode = { version = "3.0.0-rc.1", path = "contrib/bencode" }
torrust-tracker-located-error = { version = "3.0.0-rc.1", path = "packages/located-error" }
torrust-tracker-primitives = { version = "3.0.0-rc.1", path = "packages/primitives" }
torrust-tracker-torrent-repository = { version = "3.0.0-rc.1", path = "packages/torrent-repository" }
tower = { version = "0", features = ["timeout"] }
tower-http = { version = "0", features = ["compression-full", "cors", "propagate-header", "request-id", "trace"] }
trace = "0"
Expand All @@ -90,7 +90,7 @@ ignored = ["crossbeam-skiplist", "dashmap", "figment", "parking_lot", "serde_byt
[dev-dependencies]
local-ip-address = "0"
mockall = "0"
torrust-tracker-test-helpers = { version = "3.0.0-beta", path = "packages/test-helpers" }
torrust-tracker-test-helpers = { version = "3.0.0-rc.1", path = "packages/test-helpers" }

[workspace]
members = [
Expand Down
2 changes: 1 addition & 1 deletion packages/clock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ version.workspace = true
chrono = { version = "0", default-features = false, features = ["clock"] }
lazy_static = "1"

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

[dev-dependencies]
1 change: 1 addition & 0 deletions packages/clock/src/conv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use chrono::{DateTime, Utc};
use torrust_tracker_primitives::DurationSinceUnixEpoch;

/// It converts a string in ISO 8601 format to a timestamp.
///
/// For example, the string `1970-01-01T00:00:00.000Z` which is the Unix Epoch
/// will be converted to a timestamp of 0: `DurationSinceUnixEpoch::ZERO`.
///
Expand Down
2 changes: 1 addition & 1 deletion packages/configuration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ serde_json = { version = "1", features = ["preserve_order"] }
serde_with = "3"
thiserror = "1"
toml = "0"
torrust-tracker-located-error = { version = "3.0.0-beta", path = "../located-error" }
torrust-tracker-located-error = { version = "3.0.0-rc.1", path = "../located-error" }
url = "2"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion packages/test-helpers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ version.workspace = true

[dependencies]
rand = "0"
torrust-tracker-configuration = { version = "3.0.0-beta", path = "../configuration" }
torrust-tracker-configuration = { version = "3.0.0-rc.1", path = "../configuration" }
6 changes: 3 additions & 3 deletions packages/torrent-repository/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ dashmap = "6"
futures = "0"
parking_lot = "0"
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "signal", "sync"] }
torrust-tracker-clock = { version = "3.0.0-beta", path = "../clock" }
torrust-tracker-configuration = { version = "3.0.0-beta", path = "../configuration" }
torrust-tracker-primitives = { version = "3.0.0-beta", path = "../primitives" }
torrust-tracker-clock = { version = "3.0.0-rc.1", path = "../clock" }
torrust-tracker-configuration = { version = "3.0.0-rc.1", path = "../configuration" }
torrust-tracker-primitives = { version = "3.0.0-rc.1", path = "../primitives" }
zerocopy = "0"

[dev-dependencies]
Expand Down
7 changes: 5 additions & 2 deletions src/console/clients/checker/checks/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,24 @@ pub async fn run(http_trackers: Vec<Url>, timeout: Duration) -> Vec<Result<Check
tracing::debug!("HTTP trackers ...");

for ref url in http_trackers {
let mut base_url = url.clone();
base_url.set_path("");

let mut checks = Checks {
url: url.clone(),
results: Vec::default(),
};

// Announce
{
let check = check_http_announce(url, timeout).await.map(|_| ());
let check = check_http_announce(&base_url, timeout).await.map(|_| ());

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

// Scrape
{
let check = check_http_scrape(url, timeout).await.map(|_| ());
let check = check_http_scrape(&base_url, timeout).await.map(|_| ());

checks.results.push((Check::Scrape, check));
}
Expand Down
45 changes: 41 additions & 4 deletions src/console/clients/checker/checks/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::time::Duration;
use aquatic_udp_protocol::TransactionId;
use hex_literal::hex;
use serde::Serialize;
use url::Url;

use crate::console::clients::udp::checker::Client;
use crate::console::clients::udp::Error;
Expand All @@ -23,20 +24,22 @@ pub enum Check {
}

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

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

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

for remote_addr in udp_trackers {
for remote_url in udp_trackers {
let remote_addr = resolve_socket_addr(&remote_url);

let mut checks = Checks {
remote_addr,
results: Vec::default(),
};

tracing::debug!("UDP tracker: {:?}", remote_addr);
tracing::debug!("UDP tracker: {:?}", remote_url);

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

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

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

results
}

fn resolve_socket_addr(url: &Url) -> SocketAddr {
let socket_addr = url.socket_addrs(|| None).unwrap();
*socket_addr.first().unwrap()
}

#[cfg(test)]
mod tests {
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};

use url::Url;

use crate::console::clients::checker::checks::udp::resolve_socket_addr;

#[test]
fn it_should_resolve_the_socket_address_for_udp_scheme_urls_containing_a_domain() {
let socket_addr = resolve_socket_addr(&Url::parse("udp://localhost:8080").unwrap());

assert!(
socket_addr == SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080)
|| socket_addr == SocketAddr::new(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8080)
);
}

#[test]
fn it_should_resolve_the_socket_address_for_udp_scheme_urls_containing_an_ip() {
let socket_addr = resolve_socket_addr(&Url::parse("udp://localhost:8080").unwrap());

assert!(
socket_addr == SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080)
|| socket_addr == SocketAddr::new(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8080)
);
}
}
Loading

0 comments on commit 569b222

Please sign in to comment.