Skip to content

Tracker client: change the default PeerId use in clients #1564

@josecelano

Description

@josecelano

The default PeerId used in client requests is b"-qB00000000000000001".

The prefix -qB is used by qBittorrent. We should use a new one that is not already in use by another client.

I think we can use:

  • TC: In the future if we have a Torrust BitTorrent Client
  • RC: Now, for the Torrust Tracker (Rust) Client.
impl QueryBuilder {
    /// # Panics
    ///
    /// Will panic if the default info-hash value is not a valid info-hash.
    #[must_use]
    pub fn with_default_values() -> QueryBuilder {
        let default_announce_query = Query {
            info_hash: InfoHash::from_str("9c38422213e30bff212b30c360d26f9a02136422").unwrap().0, // DevSkim: ignore DS173237
            peer_addr: IpAddr::V4(Ipv4Addr::new(192, 168, 1, 88)),
            downloaded: 0,
            uploaded: 0,
            peer_id: PeerId(*b"b"-qB00000000000000001"00000000000000001").0,
            port: 17548,
            left: 0,
            event: Some(Event::Started),
            compact: Some(Compact::NotAccepted),
        };
        Self {
            announce_query: default_announce_query,
        }
    }

We can use a random ID, for example: b"-RC53070047639607806"

cc @da2ce7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions