Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions console/tracker-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ name = "torrust_tracker_console_client"
anyhow = "1"
bencode2json = "0.1"
torrust-tracker-udp-tracker-protocol = { version = "3.0.0-develop", path = "../../packages/udp-protocol" }
torrust-peer-id = "0.1.0"
torrust-info-hash = "=0.2.0"
torrust-tracker-client = { package = "torrust-tracker-client-lib", version = "3.0.0-develop", path = "../../packages/tracker-client" }
clap = { version = "4", features = [ "derive", "env" ] }
Expand Down
2 changes: 1 addition & 1 deletion console/tracker-client/src/console/clients/http/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ use bencode2json::try_bencode_to_json;
use clap::{Parser, Subcommand, ValueEnum};
use reqwest::Url;
use torrust_info_hash::InfoHash;
use torrust_peer_id::PeerId;
use torrust_tracker_client::http::client::requests::announce::{Compact, Event, QueryBuilder};
use torrust_tracker_client::http::client::responses::announce::{Announce, DeserializedCompact};
use torrust_tracker_client::http::client::responses::scrape;
use torrust_tracker_client::http::client::{Client, requests};
use torrust_tracker_udp_tracker_protocol::PeerId;

use crate::DEFAULT_NETWORK_TIMEOUT;

Expand Down
3 changes: 2 additions & 1 deletion console/tracker-client/src/console/clients/udp/checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ use std::num::NonZeroU16;
use std::time::Duration;

use torrust_info_hash::InfoHash as TorrustInfoHash;
use torrust_peer_id::PeerId;
use torrust_tracker_client::peer_id::default_production_peer_id;
use torrust_tracker_client::udp::client::UdpTrackerClient;
use torrust_tracker_udp_tracker_protocol::common::InfoHash;
use torrust_tracker_udp_tracker_protocol::{
AnnounceActionPlaceholder, AnnounceEvent, AnnounceRequest, ConnectRequest, ConnectionId, NumberOfBytes, NumberOfPeers,
PeerId, PeerKey, Port, Response, ScrapeRequest, TransactionId,
PeerKey, Port, Response, ScrapeRequest, TransactionId,
};

use super::Error;
Expand Down
2 changes: 1 addition & 1 deletion console/tracker-client/src/console/clients/unified/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use bencode2json::try_bencode_to_json;
use clap::{Subcommand, ValueEnum};
use reqwest::Url;
use torrust_info_hash::InfoHash;
use torrust_peer_id::PeerId;
use torrust_tracker_client::http::client::requests::announce::{Compact, Event, QueryBuilder};
use torrust_tracker_client::http::client::responses::announce::{Announce, DeserializedCompact};
use torrust_tracker_client::http::client::responses::scrape;
use torrust_tracker_client::http::client::{Client, requests};
use torrust_tracker_udp_tracker_protocol::PeerId;

use super::app::OutputFormat;
use crate::DEFAULT_NETWORK_TIMEOUT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ available dependency declared in its `Cargo.toml`.

## Verification

- [ ] All 4 consumers updated to import from `torrust-peer-id` directly
- [ ] Re-exports removed from `udp-protocol`
- [ ] `cargo test --workspace` — pass
- [ ] `cargo machete` — pass
- [ ] `linter all` — pass
- [x] All 4 (+1 extra) consumers updated to import from `torrust-peer-id` directly
- The `console/tracker-client` was an additional consumer beyond the original 4 listed in Scope.
- [x] Re-exports removed from `udp-protocol`
- [x] `cargo test --workspace` — pass
- [x] `cargo machete` — pass
- [x] `linter all` — pass
2 changes: 1 addition & 1 deletion packages/axum-http-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ rust-version.workspace = true
version.workspace = true

[dependencies]
torrust_tracker_udp_tracker_protocol = { package = "torrust-tracker-udp-tracker-protocol", path = "../udp-protocol" }
axum = { version = "0", features = [ "macros" ] }
axum-client-ip = "0"
axum-server = { version = "0", features = [ "tls-rustls-no-provider" ] }
Expand Down Expand Up @@ -47,6 +46,7 @@ rand = "0.9"
serde_bencode = "0"
serde_bytes = "0"
serde_repr = "0"
torrust-peer-id = "0.1.0"
torrust-tracker-test-helpers = { version = "3.0.0-develop", path = "../test-helpers" }
uuid = { version = "1", features = [ "v4" ] }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::str::FromStr;

use serde_repr::Serialize_repr;
use torrust_info_hash::InfoHash;
use torrust_tracker_udp_tracker_protocol::PeerId;
use torrust_peer_id::PeerId;

use crate::server::{ByteArray20, percent_encode_byte_array};

Expand Down
14 changes: 7 additions & 7 deletions packages/axum-http-server/tests/server/v1/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ mod for_all_config_modes {
use reqwest::{Response, StatusCode};
use tokio::net::TcpListener;
use torrust_info_hash::InfoHash;
use torrust_peer_id::PeerId;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_primitives::PeerId as DomainPeerId;
use torrust_tracker_primitives::peer::fixture::PeerBuilder;
use torrust_tracker_test_helpers::{configuration, logging};
use torrust_tracker_udp_tracker_protocol::PeerId as WirePeerId;

use crate::common::fixtures::invalid_info_hashes;
use crate::server::asserts::{
Expand Down Expand Up @@ -554,7 +554,7 @@ mod for_all_config_modes {
.announce(
&QueryBuilder::default()
.with_info_hash(&info_hash)
.with_peer_id(&WirePeerId(*b"-qB00000000000000002"))
.with_peer_id(&PeerId(*b"-qB00000000000000002"))
.query(),
)
.await;
Expand Down Expand Up @@ -610,7 +610,7 @@ mod for_all_config_modes {
.announce(
&QueryBuilder::default()
.with_info_hash(&info_hash)
.with_peer_id(&WirePeerId(*b"-qB00000000000000003"))
.with_peer_id(&PeerId(*b"-qB00000000000000003"))
.query(),
)
.await;
Expand Down Expand Up @@ -649,14 +649,14 @@ mod for_all_config_modes {

let announce_query_1 = QueryBuilder::default()
.with_info_hash(&info_hash)
.with_peer_id(&WirePeerId(peer.peer_id.0))
.with_peer_id(&PeerId(peer.peer_id.0))
.with_peer_addr(&peer.peer_addr.ip())
.with_port(peer.peer_addr.port())
.query();

let announce_query_2 = QueryBuilder::default()
.with_info_hash(&info_hash)
.with_peer_id(&WirePeerId(*b"-qB00000000000000002")) // Different peer ID
.with_peer_id(&PeerId(*b"-qB00000000000000002")) // Different peer ID
.with_peer_addr(&peer.peer_addr.ip())
.with_port(peer.peer_addr.port())
.query();
Expand Down Expand Up @@ -716,7 +716,7 @@ mod for_all_config_modes {
.announce(
&QueryBuilder::default()
.with_info_hash(&info_hash)
.with_peer_id(&WirePeerId(*b"-qB00000000000000002"))
.with_peer_id(&PeerId(*b"-qB00000000000000002"))
.with_compact(Compact::Accepted)
.query(),
)
Expand Down Expand Up @@ -764,7 +764,7 @@ mod for_all_config_modes {
.announce(
&QueryBuilder::default()
.with_info_hash(&info_hash)
.with_peer_id(&WirePeerId(*b"-qB00000000000000002"))
.with_peer_id(&PeerId(*b"-qB00000000000000002"))
.without_compact()
.query(),
)
Expand Down
1 change: 1 addition & 0 deletions packages/tracker-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ name = "torrust_tracker_client"
[dependencies]
torrust-tracker-udp-tracker-protocol = { version = "3.0.0-develop", path = "../udp-protocol" }
torrust-info-hash = "=0.2.0"
torrust-peer-id = "0.1.0"
derive_more = { version = "2", features = [ "as_ref", "constructor", "display", "from" ] }
hyper = "1"
percent-encoding = "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::str::FromStr;

use serde_repr::Serialize_repr;
use torrust_info_hash::InfoHash;
use torrust_tracker_udp_tracker_protocol::PeerId;
use torrust_peer_id::PeerId;

use crate::http::{ByteArray20, percent_encode_byte_array};
use crate::peer_id::default_production_peer_id;
Expand Down
2 changes: 1 addition & 1 deletion packages/tracker-client/src/peer_id.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::sync::OnceLock;
use std::time::{SystemTime, UNIX_EPOCH};

use torrust_tracker_udp_tracker_protocol::PeerId;
use torrust_peer_id::PeerId;

const DEFAULT_PRODUCTION_PEER_ID_PREFIX_BYTES: &[u8; 8] = b"-RC3000-";

Expand Down
3 changes: 1 addition & 2 deletions packages/udp-protocol/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ use std::fmt::Debug;
use std::net::{Ipv4Addr, Ipv6Addr};
use std::num::NonZeroU16;

pub(crate) use torrust_peer_id::PeerId;
use zerocopy::byteorder::network_endian::{I32, I64, U16, U32};
use zerocopy::{FromBytes, Immutable, IntoBytes};

pub use crate::{PeerClient, PeerId};

pub trait Ip: Clone + Copy + Debug + PartialEq + Eq + std::hash::Hash + IntoBytes + Immutable {}

#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug, IntoBytes, FromBytes, Immutable)]
Expand Down
2 changes: 0 additions & 2 deletions packages/udp-protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ pub mod request;
pub mod response;
pub mod scrape;

pub use torrust_peer_id::{PeerClient, PeerId};

pub use self::announce::*;
pub use self::common::*;
pub use self::connect::*;
Expand Down
1 change: 1 addition & 0 deletions packages/udp-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ version.workspace = true

[dependencies]
torrust_tracker_udp_tracker_protocol = { package = "torrust-tracker-udp-tracker-protocol", path = "../udp-protocol" }
torrust-peer-id = "0.1.0"
torrust-info-hash = "=0.2.0"
torrust-tracker-client = { package = "torrust-tracker-client-lib", version = "3.0.0-develop", path = "../tracker-client" }
torrust-tracker-core = { version = "3.0.0-develop", path = "../tracker-core" }
Expand Down
Loading
Loading