8000 HTTP Tracker client: Add optional parameters with the rest of the announce params · Issue #1532 · torrust/torrust-tracker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

HTTP Tracker client: Add optional parameters with the rest of the announce params #1532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tracked by #669
josecelano opened this issue May 21, 2025 · 0 comments
Open
Tracked by #669
Labels

Comments

@josecelano
Copy link
Member
josecelano commented May 21, 2025

Parent issue: #669
Relates to: #1533

Sometimes, when I'm testing, I have to simulate that a peer has completed downloading, as in this PR.

The process is pretty tedious because the client does not accept the event as an argument, so I have to make the request, change the hardcoded event, recompile it, and execute it again.

It would be nice to add a parameter.

How to do it now

  1. Change the default event from Completed to Started

In bittorrent_tracker_client::http::client::requests::announce::QueryBuilder

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"-qB00000000000000001").0,
            port: 17548,
            left: 0,
            event: Some(Event::Completed), // <- this
            compact: Some(Compact::NotAccepted),
        };
        Self {
            announce_query: default_announce_query,
        }
    }
}
  1. Run the client
cargo run -p torrust-tracker-client --bin http_tracker_client announce http://127.0.0.1:7070 443c7602b4fde83d1154d6d9da48808418b181b6 | jq
  1. Change the default event from Started to Completed

And rerun the client.

The downloads counter does not increase if the peer does not transition from Started to Completed

Proposal

Add an option parameter to pass the event (and other params):

cargo run -p torrust-tracker-client --bin http_tracker_client announce \
  http://127.0.0.1:7070 443c7602b4fde83d1154d6d9da48808418b181b6 \
  --event completed --uploaded 1234 --left 5678
@josecelano josecelano changed the title HTTP Tracker client: Add optional parameters with the reset of the announce params HTTP Tracker client: Add optional parameters with the rest of the announce params May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant
0