-
Notifications
You must be signed in to change notification settings - Fork 51
Align TrackerMode with Index #870
Copy link
Copy link
Closed
Milestone
Description
In the Index the TrackerMode is defined with:
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum TrackerMode {
// todo: use https://crates.io/crates/torrust-tracker-primitives
/// Will track every new info hash and serve every peer.
Public,
/// Will only serve authenticated peers.
Private,
/// Will only track whitelisted info hashes.
Whitelisted,
/// Will only track whitelisted info hashes and serve authenticated peers.
PrivateWhitelisted,
}
impl Default for TrackerMode {
fn default() -> Self {
Self::Public
}
}
impl TrackerMode {
#[must_use]
pub fn is_open(&self) -> bool {
matches!(self, TrackerMode::Public | TrackerMode::Whitelisted)
}
#[must_use]
pub fn is_close(&self) -> bool {
!self.is_open()
}
}We should get this type from the torrust-tracker-primitives crate and update the Index. Howeveer the Index has added the concept "open" and "close". We need to add this concept to the enum in the Tracker before we update the Index.
TrackerMode in the Tracker.
#[derive(Serialize, Deserialize, Copy, Clone, PartialEq, Eq, Debug)]
pub enum TrackerMode {
/// Will track every new info hash and serve every peer.
#[serde(rename = "public")]
Public,
/// Will only track whitelisted info hashes.
#[serde(rename = "listed")]
Listed,
/// Will only serve authenticated peers
#[serde(rename = "private")]
Private,
/// Will only track whitelisted info hashes and serve authenticated peers
#[serde(rename = "private_listed")]
PrivateListed,
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status