Skip to content

Commit

Permalink
chore: fix doc warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
da2ce7 committed Oct 13, 2023
1 parent 7dbca2b commit 417ad73
Show file tree
Hide file tree
Showing 35 changed files with 77 additions and 77 deletions.
4 changes: 2 additions & 2 deletions src/bootstrap/app.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Setup for the main tracker application.
//!
//! The [`setup`](bootstrap::app::setup) only builds the application and its dependencies but it does not start the application.
//! The [`setup`] only builds the application and its dependencies but it does not start the application.
//! In fact, there is no such thing as the main application process. When the application starts, the only thing it does is
//! starting a bunch of independent jobs. If you are looking for how things are started you should read [`app::start`](crate::app::start)
//! function documentation.
Expand All @@ -22,7 +22,7 @@ use crate::shared::crypto::ephemeral_instance_keys;
use crate::tracker::services::tracker_factory;
use crate::tracker::Tracker;

/// It loads the configuration from the environment and builds the main domain [`tracker`](crate::tracker::Tracker) struct.
/// It loads the configuration from the environment and builds the main domain [`Tracker`] struct.
#[must_use]
pub fn setup() -> (Arc<Configuration>, Arc<Tracker>) {
let configuration = Arc::new(initialize_configuration());
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/jobs/http_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! The [`http_tracker::start_job`](crate::bootstrap::jobs::http_tracker::start_job) function spawns a new asynchronous task,
//! that tasks is the "**launcher**". The "**launcher**" starts the actual server and sends a message back to the main application.
//! The main application waits until receives the message [`ServerJobStarted`](crate::bootstrap::jobs::http_tracker::ServerJobStarted) from the "**launcher**".
//! The main application waits until receives the message [`ServerJobStarted`] from the "**launcher**".
//!
//! The "**launcher**" is an intermediary thread that decouples the HTTP servers from the process that handles it. The HTTP could be used independently in the future.
//! In that case it would not need to notify a parent process.
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/jobs/tracker_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! function spawns a new asynchronous task, that tasks is the "**launcher**".
//! The "**launcher**" starts the actual server and sends a message back
//! to the main application. The main application waits until receives
//! the message [`ApiServerJobStarted`](crate::bootstrap::jobs::tracker_apis::ApiServerJobStarted)
//! the message [`ApiServerJobStarted`]
//! from the "**launcher**".
//!
//! The "**launcher**" is an intermediary thread that decouples the API server
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
//!
//! Torrust Tracker has four main components:
//!
//! - The core [`tracker`](crate::tracker)
//! - The core [`tracker`]
//! - The tracker REST [`API`](crate::servers::apis)
//! - The [`UDP`](crate::servers::udp) tracker
//! - The [`HTTP`](crate::servers::http) tracker
Expand All @@ -402,7 +402,7 @@
//! - Statistics
//! - Persistence
//!
//! See [`tracker`](crate::tracker) for more details on the [`tracker`](crate::tracker) module.
//! See [`tracker`] for more details on the [`tracker`] module.
//!
//! ## Tracker API
//!
Expand Down
6 changes: 3 additions & 3 deletions src/servers/apis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! > **NOTICE**: This API should not be exposed directly to the internet, it is
//! intended for internal use only.
//!
//! Endpoints for the latest API: [v1](crate::servers::apis::v1).
//! Endpoints for the latest API: [v1].
//!
//! All endpoints require an authorization token which must be set in the
//! configuration before running the tracker. The default configuration uses
Expand Down Expand Up @@ -139,13 +139,13 @@
//!
//! The API is versioned and each version has its own module.
//! The API server runs all the API versions on the same server using
//! the same port. Currently there is only one API version: [v1](crate::servers::apis::v1)
//! the same port. Currently there is only one API version: [v1]
//! but a version [`v2`](https://github.com/torrust/torrust-tracker/issues/144)
//! is planned.
//!
//! # Endpoints
//!
//! Refer to the [v1](crate::servers::apis::v1) module for the list of available
//! Refer to the [v1] module for the list of available
//! API endpoints.
//!
//! # Documentation
Expand Down
2 changes: 1 addition & 1 deletion src/servers/apis/v1/context/auth_key/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::tracker::Tracker;
///
/// It returns two types of responses:
///
/// - `200` with an json [`AuthKey`](crate::servers::apis::v1::context::auth_key::resources::AuthKey)
/// - `200` with an json [`AuthKey`]
/// resource. If the key was generated successfully.
/// - `500` with serialized error in debug format. If the key couldn't be
/// generated.
Expand Down
2 changes: 1 addition & 1 deletion src/servers/apis/v1/context/stats/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::tracker::Tracker;

/// It handles the request to get the tracker statistics.
///
/// It returns a `200` response with a json [`Stats`](crate::servers::apis::v1::context::stats::resources::Stats)
/// It returns a `200` response with a json [`Stats`]
///
/// Refer to the [API endpoint documentation](crate::servers::apis::v1::context::stats#get-tracker-statistics)
/// for more information about this endpoint.
Expand Down
2 changes: 1 addition & 1 deletion src/servers/apis/v1/context/stats/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use axum::response::Json;
use super::resources::Stats;
use crate::tracker::services::statistics::TrackerMetrics;

/// `200` response that contains the [`Stats`](crate::servers::apis::v1::context::stats::resources::Stats) resource as json.
/// `200` response that contains the [`Stats`] resource as json.
pub fn stats_response(tracker_metrics: TrackerMetrics) -> Json<Stats> {
Json(Stats::from(tracker_metrics))
}
2 changes: 1 addition & 1 deletion src/servers/apis/v1/context/torrent/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct PaginationParams {
/// It handles the request to get a list of torrents.
///
/// It returns a `200` response with a json array with
/// [`ListItem`](crate::servers::apis::v1::context::torrent::resources::torrent::ListItem)
/// [`ListItem`]
/// resources.
///
/// Refer to the [API endpoint documentation](crate::servers::apis::v1::context::torrent#list-torrents)
Expand Down
2 changes: 1 addition & 1 deletion src/servers/apis/v1/context/torrent/resources/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::tracker;
/// `Peer` API resource.
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct Peer {
/// The peer's ID. See [`Id`](crate::servers::apis::v1::context::torrent::resources::peer::Id).
/// The peer's ID. See [`Id`].
pub peer_id: Id,
/// The peer's socket address. For example: `192.168.1.88:17548`.
pub peer_addr: String,
Expand Down
4 changes: 2 additions & 2 deletions src/servers/apis/v1/context/torrent/resources/torrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ impl ListItem {
}
}

/// Maps an array of the domain type [`BasicInfo`](crate::tracker::services::torrent::BasicInfo)
/// to the API resource type [`ListItem`](crate::servers::apis::v1::context::torrent::resources::torrent::ListItem).
/// Maps an array of the domain type [`BasicInfo`]
/// to the API resource type [`ListItem`].
#[must_use]
pub fn to_resource(basic_info_vec: &[BasicInfo]) -> Vec<ListItem> {
basic_info_vec
Expand Down
4 changes: 2 additions & 2 deletions src/servers/apis/v1/context/torrent/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ use super::resources::torrent::{ListItem, Torrent};
use crate::tracker::services::torrent::{BasicInfo, Info};

/// `200` response that contains an array of
/// [`ListItem`](crate::servers::apis::v1::context::torrent::resources::torrent::ListItem)
/// [`ListItem`]
/// resources as json.
pub fn torrent_list_response(basic_infos: &[BasicInfo]) -> Json<Vec<ListItem>> {
Json(ListItem::new_vec(basic_infos))
}

/// `200` response that contains a
/// [`Torrent`](crate::servers::apis::v1::context::torrent::resources::torrent::Torrent)
/// [`Torrent`]
/// resources as json.
pub fn torrent_info_response(info: Info) -> Json<Torrent> {
Json(Torrent::from(info))
Expand Down
4 changes: 2 additions & 2 deletions src/servers/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@
//! > **NOTICE**: the `info_hash` parameter is NOT a `URL` encoded string param.
//! It is percent encode of the raw `info_hash` bytes (40 bytes). URL `GET` params
//! can contain any bytes, not only well-formed UTF-8. The `info_hash` is a
//! 20-byte SHA1. Check the [`percent_encoding`](crate::servers::http::percent_encoding)
//! 20-byte SHA1. Check the [`percent_encoding`]
//! module to know more about the encoding.
//!
//! > **NOTICE**: the `peer_id` parameter is NOT a `URL` encoded string param.
//! It is percent encode of the raw peer ID bytes (20 bytes). URL `GET` params
//! can contain any bytes, not only well-formed UTF-8. The `info_hash` is a
//! 20-byte SHA1. Check the [`percent_encoding`](crate::servers::http::percent_encoding)
//! 20-byte SHA1. Check the [`percent_encoding`]
//! module to know more about the encoding.
//!
//! > **NOTICE**: by default, the tracker returns the non-compact peer list when
Expand Down
6 changes: 3 additions & 3 deletions src/servers/http/percent_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::shared::bit_torrent::info_hash::{ConversionError, InfoHash};
use crate::tracker::peer::{self, IdConversionError};

/// Percent decodes a percent encoded infohash. Internally an
/// [`InfoHash`](crate::shared::bit_torrent::info_hash::InfoHash) is a 20-byte array.
/// [`InfoHash`] is a 20-byte array.
///
/// For example, given the infohash `3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0`,
/// it's percent encoded representation is `%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0`.
Expand All @@ -43,7 +43,7 @@ use crate::tracker::peer::{self, IdConversionError};
/// # Errors
///
/// Will return `Err` if the decoded bytes do not represent a valid
/// [`InfoHash`](crate::shared::bit_torrent::info_hash::InfoHash).
/// [`InfoHash`].
pub fn percent_decode_info_hash(raw_info_hash: &str) -> Result<InfoHash, ConversionError> {
let bytes = percent_encoding::percent_decode_str(raw_info_hash).collect::<Vec<u8>>();
InfoHash::try_from(bytes)
Expand All @@ -70,7 +70,7 @@ pub fn percent_decode_info_hash(raw_info_hash: &str) -> Result<InfoHash, Convers
///
/// # Errors
///
/// Will return `Err` if if the decoded bytes do not represent a valid [`peer::Id`](crate::tracker::peer::Id).
/// Will return `Err` if if the decoded bytes do not represent a valid [`peer::Id`].
pub fn percent_decode_peer_id(raw_peer_id: &str) -> Result<peer::Id, IdConversionError> {
let bytes = percent_encoding::percent_decode_str(raw_peer_id).collect::<Vec<u8>>();
peer::Id::try_from(bytes)
Expand Down
6 changes: 3 additions & 3 deletions src/servers/http/v1/extractors/announce_request.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Axum [`extractor`](axum::extract) for the [`Announce`](crate::servers::http::v1::requests::announce::Announce)
//! Axum [`extractor`](axum::extract) for the [`Announce`]
//! request.
//!
//! It parses the query parameters returning an [`Announce`](crate::servers::http::v1::requests::announce::Announce)
//! It parses the query parameters returning an [`Announce`]
//! request.
//!
//! Refer to [`Announce`](crate::servers::http::v1::requests::announce) for more
Expand Down Expand Up @@ -38,7 +38,7 @@ use crate::servers::http::v1::query::Query;
use crate::servers::http::v1::requests::announce::{Announce, ParseAnnounceQueryError};
use crate::servers::http::v1::responses;

/// Extractor for the [`Announce`](crate::servers::http::v1::requests::announce::Announce)
/// Extractor for the [`Announce`]
/// request.
pub struct ExtractRequest(pub Announce);

Expand Down
4 changes: 2 additions & 2 deletions src/servers/http/v1/extractors/authentication_key.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Axum [`extractor`](axum::extract) to extract the authentication [`Key`](crate::tracker::auth::Key)
//! Axum [`extractor`](axum::extract) to extract the authentication [`Key`]
//! from the URL path.
//!
//! It's only used when the tracker is running in private mode.
Expand Down Expand Up @@ -55,7 +55,7 @@ use crate::servers::http::v1::handlers::common::auth;
use crate::servers::http::v1::responses;
use crate::tracker::auth::Key;

/// Extractor for the [`Key`](crate::tracker::auth::Key) struct.
/// Extractor for the [`Key`] struct.
pub struct Extract(pub Key);

#[derive(Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion src/servers/http/v1/extractors/client_ip_sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use axum_client_ip::RightmostXForwardedFor;

use crate::servers::http::v1::services::peer_ip_resolver::ClientIpSources;

/// Extractor for the [`ClientIpSources`](crate::servers::http::v1::services::peer_ip_resolver::ClientIpSources)
/// Extractor for the [`ClientIpSources`]
/// struct.
pub struct Extract(pub ClientIpSources);

Expand Down
6 changes: 3 additions & 3 deletions src/servers/http/v1/extractors/scrape_request.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Axum [`extractor`](axum::extract) for the [`Scrape`](crate::servers::http::v1::requests::scrape::Scrape)
//! Axum [`extractor`](axum::extract) for the [`Scrape`]
//! request.
//!
//! It parses the query parameters returning an [`Scrape`](crate::servers::http::v1::requests::scrape::Scrape)
//! It parses the query parameters returning an [`Scrape`]
//! request.
//!
//! Refer to [`Scrape`](crate::servers::http::v1::requests::scrape) for more
Expand Down Expand Up @@ -38,7 +38,7 @@ use crate::servers::http::v1::query::Query;
use crate::servers::http::v1::requests::scrape::{ParseScrapeQueryError, Scrape};
use crate::servers::http::v1::responses;

/// Extractor for the [`Scrape`](crate::servers::http::v1::requests::scrape::Scrape)
/// Extractor for the [`Scrape`]
/// request.
pub struct ExtractRequest(pub Scrape);

Expand Down
2 changes: 1 addition & 1 deletion src/servers/http/v1/handlers/common/auth.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! HTTP server authentication error and conversion to
//! [`responses::error::Error`](crate::servers::http::v1::responses::error::Error)
//! [`responses::error::Error`]
//! response.
use std::panic::Location;

Expand Down
2 changes: 1 addition & 1 deletion src/servers/http/v1/handlers/common/peer_ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! The HTTP tracker may fail to resolve the peer IP address. This module
//! contains the logic to convert those
//! [`PeerIpResolutionError`](crate::servers::http::v1::services::peer_ip_resolver::PeerIpResolutionError)
//! [`PeerIpResolutionError`]
//! errors into responses.
use crate::servers::http::v1::responses;
use crate::servers::http::v1::services::peer_ip_resolver::PeerIpResolutionError;
Expand Down
2 changes: 1 addition & 1 deletion src/servers/http/v1/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Query {
}
}

/// This error can be returned when parsing a [`Query`](crate::servers::http::v1::query::Query)
/// This error can be returned when parsing a [`Query`]
/// from a string.
#[derive(Error, Debug)]
pub enum ParseQueryError {
Expand Down
4 changes: 2 additions & 2 deletions src/servers/http/v1/responses/announce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub struct NonCompact {
pub peers: Vec<Peer>,
}

/// Peer information in the [`NonCompact`](crate::servers::http::v1::responses::announce::NonCompact)
/// Peer information in the [`NonCompact`]
/// response.
///
/// ```rust
Expand Down Expand Up @@ -261,7 +261,7 @@ pub struct Compact {
pub peers: Vec<CompactPeer>,
}

/// Compact peer. It's used in the [`Compact`](crate::servers::http::v1::responses::announce::Compact)
/// Compact peer. It's used in the [`Compact`]
/// response.
///
/// _"To reduce the size of tracker responses and to reduce memory and
Expand Down
6 changes: 3 additions & 3 deletions src/servers/http/v1/services/announce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
//! The service is responsible for handling the `announce` requests.
//!
//! It delegates the `announce` logic to the [`Tracker`](crate::tracker::Tracker::announce)
//! and it returns the [`AnnounceData`](crate::tracker::AnnounceData) returned
//! by the [`Tracker`](crate::tracker::Tracker).
//! and it returns the [`AnnounceData`] returned
//! by the [`Tracker`].
//!
//! It also sends an [`statistics::Event`](crate::tracker::statistics::Event)
//! It also sends an [`statistics::Event`]
//! because events are specific for the HTTP tracker.
use std::net::IpAddr;
use std::sync::Arc;
Expand Down
6 changes: 3 additions & 3 deletions src/servers/http/v1/services/scrape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
//! The service is responsible for handling the `scrape` requests.
//!
//! It delegates the `scrape` logic to the [`Tracker`](crate::tracker::Tracker::scrape)
//! and it returns the [`ScrapeData`](crate::tracker::ScrapeData) returned
//! by the [`Tracker`](crate::tracker::Tracker).
//! and it returns the [`ScrapeData`] returned
//! by the [`Tracker`].
//!
//! It also sends an [`statistics::Event`](crate::tracker::statistics::Event)
//! It also sends an [`statistics::Event`]
//! because events are specific for the HTTP tracker.
use std::net::IpAddr;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion src/servers/udp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
//! connection ID = hash(client IP + current time slot + secret seed)
//! ```
//!
//! The BEP-15 recommends a two-minute time slot. Refer to [`connection_cookie`](crate::servers::udp::connection_cookie)
//! The BEP-15 recommends a two-minute time slot. Refer to [`connection_cookie`]
//! for more information about the connection ID generation with this method.
//!
//! #### Connect Request
Expand Down
2 changes: 1 addition & 1 deletion src/servers/udp/peer_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::request::AnnounceWrapper;
use crate::shared::clock::{Current, Time};
use crate::tracker::peer::{Id, Peer};

/// Extracts the [`Peer`](crate::tracker::peer::Peer) info from the
/// Extracts the [`Peer`] info from the
/// announce request.
///
/// # Arguments
Expand Down
4 changes: 2 additions & 2 deletions src/servers/udp/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use aquatic_udp_protocol::AnnounceRequest;

use crate::shared::bit_torrent::info_hash::InfoHash;

/// Wrapper around [`AnnounceRequest`](aquatic_udp_protocol::request::AnnounceRequest).
/// Wrapper around [`AnnounceRequest`].
pub struct AnnounceWrapper {
/// [`AnnounceRequest`](aquatic_udp_protocol::request::AnnounceRequest) to wrap.
/// [`AnnounceRequest`] to wrap.
pub announce_request: AnnounceRequest,
/// Info hash of the torrent.
pub info_hash: InfoHash,
Expand Down
6 changes: 3 additions & 3 deletions src/servers/udp/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//!
//! There are two main types in this module:
//!
//! - [`UdpServer`](crate::servers::udp::server::UdpServer): a controller to
//! - [`UdpServer`]: a controller to
//! start and stop the server.
//! - [`Udp`](crate::servers::udp::server::Udp): the server launcher.
//! - [`Udp`]: the server launcher.
//!
//! The `UdpServer` is an state machine for a given configuration. This struct
//! represents concrete configuration and state. It allows to start and
Expand Down Expand Up @@ -42,7 +42,7 @@ use crate::tracker::Tracker;
///
/// Some errors triggered while stopping the server are:
///
/// - The [`UdpServer`](crate::servers::udp::server::UdpServer) cannot send the
/// - The [`UdpServer`] cannot send the
/// shutdown signal to the spawned UDP service thread.
#[derive(Debug)]
pub enum Error {
Expand Down
Loading

0 comments on commit 417ad73

Please sign in to comment.