Skip to content

Commit 69a09d7

Browse files
committed
refactor: rename mnd extract mods
`protocol` nod contains logic not only for BitTorrent protocol.
1 parent 6fdb0ad commit 69a09d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+93
-94
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pub mod app;
22
pub mod bootstrap;
3-
pub mod protocol;
43
pub mod servers;
4+
pub mod shared;
55
pub mod tracker;
66

77
#[macro_use]

src/protocol/mod.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/servers/apis/v1/context/auth_key/resources.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::convert::From;
22

33
use serde::{Deserialize, Serialize};
44

5-
use crate::protocol::clock::convert_from_iso_8601_to_timestamp;
5+
use crate::shared::clock::convert_from_iso_8601_to_timestamp;
66
use crate::tracker::auth::{self, Key};
77

88
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
@@ -36,7 +36,7 @@ mod tests {
3636
use std::time::Duration;
3737

3838
use super::AuthKey;
39-
use crate::protocol::clock::{Current, TimeNow};
39+
use crate::shared::clock::{Current, TimeNow};
4040
use crate::tracker::auth::{self, Key};
4141

4242
struct TestTime {

src/servers/apis/v1/context/torrent/handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use serde::{de, Deserialize, Deserializer};
88

99
use super::resources::torrent::ListItem;
1010
use super::responses::{torrent_info_response, torrent_list_response, torrent_not_known_response};
11-
use crate::protocol::info_hash::InfoHash;
1211
use crate::servers::apis::v1::responses::invalid_info_hash_param_response;
1312
use crate::servers::apis::InfoHashParam;
13+
use crate::shared::bit_torrent::info_hash::InfoHash;
1414
use crate::tracker::services::torrent::{get_torrent_info, get_torrents, Pagination};
1515
use crate::tracker::Tracker;
1616

src/servers/apis/v1/context/torrent/resources/torrent.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ mod tests {
7575
use aquatic_udp_protocol::{AnnounceEvent, NumberOfBytes};
7676

7777
use super::Torrent;
78-
use crate::protocol::clock::DurationSinceUnixEpoch;
79-
use crate::protocol::info_hash::InfoHash;
8078
use crate::servers::apis::v1::context::torrent::resources::peer::Peer;
8179
use crate::servers::apis::v1::context::torrent::resources::torrent::ListItem;
80+
use crate::shared::bit_torrent::info_hash::InfoHash;
81+
use crate::shared::clock::DurationSinceUnixEpoch;
8282
use crate::tracker::peer;
8383
use crate::tracker::services::torrent::{BasicInfo, Info};
8484

src/servers/apis/v1/context/whitelist/handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use axum::response::Response;
77
use super::responses::{
88
failed_to_reload_whitelist_response, failed_to_remove_torrent_from_whitelist_response, failed_to_whitelist_torrent_response,
99
};
10-
use crate::protocol::info_hash::InfoHash;
1110
use crate::servers::apis::v1::responses::{invalid_info_hash_param_response, ok_response};
1211
use crate::servers::apis::InfoHashParam;
12+
use crate::shared::bit_torrent::info_hash::InfoHash;
1313
use crate::tracker::Tracker;
1414

1515
pub async fn add_torrent_to_whitelist_handler(

src/servers/http/percent_encoding.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::protocol::info_hash::{ConversionError, InfoHash};
1+
use crate::shared::bit_torrent::info_hash::{ConversionError, InfoHash};
22
use crate::tracker::peer::{self, IdConversionError};
33

44
/// # Errors
@@ -21,8 +21,8 @@ pub fn percent_decode_peer_id(raw_peer_id: &str) -> Result<peer::Id, IdConversio
2121
mod tests {
2222
use std::str::FromStr;
2323

24-
use crate::protocol::info_hash::InfoHash;
2524
use crate::servers::http::percent_encoding::{percent_decode_info_hash, percent_decode_peer_id};
25+
use crate::shared::bit_torrent::info_hash::InfoHash;
2626
use crate::tracker::peer;
2727

2828
#[test]

src/servers/http/v1/extractors/announce_request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ mod tests {
5353
use std::str::FromStr;
5454

5555
use super::extract_announce_from;
56-
use crate::protocol::info_hash::InfoHash;
5756
use crate::servers::http::v1::requests::announce::{Announce, Compact, Event};
5857
use crate::servers::http::v1::responses::error::Error;
58+
use crate::shared::bit_torrent::info_hash::InfoHash;
5959
use crate::tracker::peer;
6060

6161
fn assert_error_response(error: &Error, error_message: &str) {

src/servers/http/v1/extractors/scrape_request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ mod tests {
5353
use std::str::FromStr;
5454

5555
use super::extract_scrape_from;
56-
use crate::protocol::info_hash::InfoHash;
5756
use crate::servers::http::v1::requests::scrape::Scrape;
5857
use crate::servers::http::v1::responses::error::Error;
58+
use crate::shared::bit_torrent::info_hash::InfoHash;
5959

6060
struct TestInfoHash {
6161
pub bencoded: String,

src/servers/http/v1/handlers/announce.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use axum::extract::State;
77
use axum::response::{IntoResponse, Response};
88
use log::debug;
99

10-
use crate::protocol::clock::{Current, Time};
1110
use crate::servers::http::v1::extractors::announce_request::ExtractRequest;
1211
use crate::servers::http::v1::extractors::authentication_key::Extract as ExtractKey;
1312
use crate::servers::http::v1::extractors::client_ip_sources::Extract as ExtractClientIpSources;
@@ -16,6 +15,7 @@ use crate::servers::http::v1::requests::announce::{Announce, Compact, Event};
1615
use crate::servers::http::v1::responses::{self, announce};
1716
use crate::servers::http::v1::services::peer_ip_resolver::ClientIpSources;
1817
use crate::servers::http::v1::services::{self, peer_ip_resolver};
18+
use crate::shared::clock::{Current, Time};
1919
use crate::tracker::auth::Key;
2020
use crate::tracker::peer::Peer;
2121
use crate::tracker::{AnnounceData, Tracker};
@@ -141,10 +141,10 @@ mod tests {
141141

142142
use torrust_tracker_test_helpers::configuration;
143143

144-
use crate::protocol::info_hash::InfoHash;
145144
use crate::servers::http::v1::requests::announce::Announce;
146145
use crate::servers::http::v1::responses;
147146
use crate::servers::http::v1::services::peer_ip_resolver::ClientIpSources;
147+
use crate::shared::bit_torrent::info_hash::InfoHash;
148148
use crate::tracker::services::common::tracker_factory;
149149
use crate::tracker::{peer, Tracker};
150150

0 commit comments

Comments
 (0)