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

Overhaul tracker keys in torrents and magnet links #494

Merged

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Feb 23, 2024

1. Tracker running in `Public` or `Whitelisted` mode. 
   Downloaded torrents should never include any tracker key.
3. Tracker running in `Private` or `PrivateListed` mode.
   2.1 Guest user. 
       Downloaded torrents should never include any tracker key.
   2.2 Authenticated user
       2.2.1 Index can get the tracker user's key (from the Index database or generate new ones).
             - We should include the user's tracker key.
             - We should change the download torrent button label from `download torrent` to `download private torrent` (this is an Idex GUI issue).
       2.2.2 The user's tracker key is expired and the tracker API is unavailable (can't generate a new one).
             Return a `503 Service Unavailable` response with the text `Can't generate user's tracker key`.

Subtasks

  • Never include keys in the downloaded torrent file when the tracker is open (public or public-whitelisted).
  • Never include keys in the magnet link when the tracker is open (public or public-whitelisted).
  • Return an error when we can't connect to the tracker to generate the user's keys. Both for the download torrent endpoint and torrent details endpoint (magnet link).
  • Return 503 instead of 500 when the tracker is offline and for example we can not generate the user's tracker keys.
  • Removed duplicate URLs in the tracker lists. Both torrent file and torrent info endpoints.
  • Force the main tracker URL (the one in the tracker config) to be the first in the tracker lists, both in the tracker torrent file endpoint and the torrent details endpoint.
  • Panic starting the application with an invalid racker configuration. For example: private UDP tracker.

Subtasks in the Index GUI

@josecelano josecelano linked an issue Feb 23, 2024 that may be closed by this pull request
@josecelano josecelano self-assigned this Feb 23, 2024
@josecelano josecelano added Bug Incorrect Behavior Enhancement / Feature Request Something New labels Feb 23, 2024
@josecelano josecelano force-pushed the 488-overhaul-tracker-keys-in-torrents branch from 8cab267 to 10b3670 Compare February 23, 2024 12:42
@josecelano
Copy link
Member Author

josecelano commented Feb 23, 2024

It's not easy to test this new behavior because the current test is using the "shared" env which uses a public tracker. I should run a second env with a private tracker but I think that's too complex. I would prefer to test this functionality with unit tests. The problem is the torrust_index::services::torrent::Index service is too big. Maybe we could refactor it to a command/handler pattern.

For the time being, I will test manually and remove the E2E test for the personal announce URL.

cc @WarmBeer @da2ce7

@josecelano josecelano force-pushed the 488-overhaul-tracker-keys-in-torrents branch from 10b3670 to bc509f4 Compare February 23, 2024 15:53
@josecelano josecelano force-pushed the 488-overhaul-tracker-keys-in-torrents branch from bc509f4 to a67c39b Compare February 23, 2024 16:27
Tracker HTTP URL: http://localhost:7070

- announce: "http://localhost:7070".
- announce_list: "http://localhost:7070" and keeps the original URLs in the uploaded torrent.

Tracker UDP URL: udp://localhost:6969

- announce: "udp://localhost:7070".
- announce_list: "udp://localhost:7070" and keeps the original URLs in the uploaded torrent.

Tracker HTTP URL: http://localhost:7070

- announce: "http://localhost:7070/**KEY**".
- announce_list: "http://localhost:7070/**KEY**" and keeps the original URLs in the uploaded torrent.

Tracker UDP URL: udp://localhost:6969

- announce: "udp://localhost:7070/**KEY**".
- announce_list: "udp://localhost:7070/**KEY**" and keeps the original URLs in the uploaded torrent.

It returns an 505 error if it can't get the user's tracker keys.

TODO:

- The application should not start with close tracker and UDP url in the
  configuration.
- The API should return 503 instead of 500 when it can't connect to the
  tracker.
@josecelano josecelano force-pushed the 488-overhaul-tracker-keys-in-torrents branch from f2bea54 to d100b5b Compare February 23, 2024 17:58
when the Index needs to make a request to the Tracker API and is not
available.
…alid

For the time being, it only checks that private tracker don't use UDP.
@josecelano josecelano marked this pull request as ready for review February 23, 2024 18:25
@josecelano
Copy link
Member Author

ACK 9b7c5c8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Incorrect Behavior Enhancement / Feature Request Something New
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overhaul tracker keys in torrents and magnet links
1 participant