Skip to content
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

UDP Tracker Client: add scrape request #655

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Jan 29, 2024

Command:

$ cargo run --bin udp_tracker_client scrape udp://localhost:6969/scrape 9c38422213e30bff212b30c360d26f9a02136422 | jq
    Finished dev [optimized + debuginfo] target(s) in 0.07s
     Running `target/debug/udp_tracker_client scrape 'udp://localhost:6969/scrape' 9c38422213e30bff212b30c360d26f9a02136422`

Output:

{
  "torrent_stats": [
    {
      "completed": 0,
      "leechers": 0,
      "seeders": 0
    }
  ],
  "transaction_id": -888840697
}

Subtasks

  • Print JSON instead of debug struct.
  • Use anyhow and clap. See HTTP Tracker client.
  • scrape command.
  • Allow using a domain. Currently, it only allows using an IP.

@josecelano josecelano self-assigned this Jan 29, 2024
@josecelano josecelano added the Testing Checking Torrust label Jan 29, 2024
@josecelano josecelano added this to the v3.0.0 milestone Jan 29, 2024
@josecelano josecelano added the - Admin - Enjoyable to Install and Setup our Software label Jan 29, 2024
@josecelano josecelano linked an issue Jan 29, 2024 that may be closed by this pull request
4 tasks
Copy link

codecov bot commented Jan 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c526cc1) 75.05% compared to head (f4e9bda) 75.05%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #655   +/-   ##
========================================
  Coverage    75.05%   75.05%           
========================================
  Files          136      136           
  Lines         8902     8902           
========================================
  Hits          6681     6681           
  Misses        2221     2221           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

```console
$ cargo run --bin udp_tracker_client announce 127.0.0.1:6969 9c38422213e30bff212b30c360d26f9a02136422 | jq
   Compiling torrust-tracker v3.0.0-alpha.12-develop (/home/josecelano/Documents/git/committer/me/github/torrust/torrust-tracker)
    Finished dev [optimized + debuginfo] target(s) in 2.60s
     Running `target/debug/udp_tracker_client '127.0.0.1:6969' 9c38422213e30bff212b30c360d26f9a02136422`
{
  "announce_interval": 120,
  "leechers": 0,
  "peers": [],
  "seeders": 1,
  "transaction_id": -888840697
}
```
@josecelano josecelano force-pushed the 654-udp-tracker-client-add-scrape-request branch from c37e6c1 to 1b34d93 Compare January 29, 2024 13:56
```text
cargo run --bin udp_tracker_client scrape 127.0.0.1:6969 9c38422213e30bff212b30c360d26f9a02136422 | jq
cargo run --bin udp_tracker_client scrape udp://localhost:6969 9c38422213e30bff212b30c360d26f9a02136422 | jq
```

Scrape response:

```json
{
  "transaction_id": -888840697,
  "torrent_stats": [
    {
      "completed": 0,
      "leechers": 0,
      "seeders": 0
    },
    {
      "completed": 0,
      "leechers": 0,
      "seeders": 0
   }
 ]
}
```
@josecelano josecelano force-pushed the 654-udp-tracker-client-add-scrape-request branch from ea01059 to f4e9bda Compare January 29, 2024 16:57
@josecelano josecelano marked this pull request as ready for review January 29, 2024 16:58
@josecelano
Copy link
Member Author

ACK f4e9bda

@josecelano josecelano requested a review from da2ce7 January 29, 2024 16:58
@josecelano josecelano merged commit 75a502f into torrust:develop Jan 29, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Admin - Enjoyable to Install and Setup our Software Testing Checking Torrust
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

UDP Tracker Client: add scrape request
1 participant