-
Notifications
You must be signed in to change notification settings - Fork 47
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 core Tracker: review whitelist functionality #1268
Labels
Comments
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
Following HTTP structure.
13 tasks
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
…racker_core package
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 14, 2025
…cker_core package
6 tasks
josecelano
added a commit
that referenced
this issue
Feb 14, 2025
eca5c59 refactor: [#1268] move scrape logic from udp server to udp_tracker_core package (Jose Celano) c0fc390 refactor: [#1268] move announce logic from udp server to udp_tracker_core package (Jose Celano) 37a142e refactor: [#1268] move scrape logic from axum to http_tracker_core package (Jose Celano) 74815ab refactor: [#1268] move announce logic from axum to http_tracker_core package (Jose Celano) e48aaf5 [#1268] move udp services to udp_tracker_core package (Jose Celano) 73753e3 [#1268] move http services to http_tracker_core package (Jose Celano) dec742e refactor: [#1268] extract servers::udp::services::scrape service (Jose Celano) 3c07b26 refactor: [#1268] extract servers::udp::services::announce service (Jose Celano) 81825c9 refactor: [#1268] separate UDP handlers into diferent modules (Jose Celano) Pull request description: Overhaul core Tracker: review whitelist functionality. ### Sub-tasks - [x] Introduce submodules for handlers in UDP: `servers::udp::handlers::{announce, scrape}`. - [x] Create the missing services (app layer) in the UDP tracker. There is no intermediary level between handlers and the core tracker. It will moved to its own package `udp-tracker-core` later. - [x] Move the service `services::announce::invoke()` in the HTTP tracker to the `http-tracker-core` package. - [x] Move the service `services::announce::invoke()` in the UDP tracker to the `udp-tracker-core` package. - [x] Move logic from the handler (in the framework level - delivery layer) to the application service in the `http-tracker-core` package. - [x] For the `announce` request - [x] For the `scrape` request - [x] Move logic from the handler (controller level - delivery layer) to the application service in the `udp-tracker-core` package. - [x] For the `announce` request - [x] For the `scrape` request - [ ] ~~Add version module also for the UDP tracker. I don't see any reason to use `v1` in the http tracker but not in the UDP tracker.~~ I will leave this until we introduce a new major version. ### Sub-tasks for a new PR I've left these tasks for a new [issue](#1270). This PR is just moving things and the new tasks imply changing function signatures. - [ ] In the tracker-core announce handler return a `Result<AnnounceData, AnnounceError>` when the torrent is not included in the whitelist. - [ ] In the tracker-core scrape handler return a `Result<ScrapeData, ScrapeError>` so we are able to return errors in the future without breaking the public API. ACKs for top commit: josecelano: ACK eca5c59 Tree-SHA512: d3ee37ffa806e8a86813fe564e3840fab7bfc44d2072f85bc2eba84ac3402c95c0f6a5beb2725071cb0498415f55915431b656e98c71b3a6bf469de961c37f03
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Parent issue: #1261
Context
Some months ago I wrote a comment on the function to handle an announce request in the tracker core.
The tracker can work on
listed
mode, meaning it only accepts torrents whose info-hash have been included in the whitelist. There was an smell in the code because the whitelist authorization is performed at the delivery layer (controllers) for the announce request but in the scrape handler (domain) in the tracker core for the scrape request. It's strange that is not done at the same level.In this issue I'm going to explain how the whitelist currently works and how I think it should work. I'm also going to explain how it's implemented (specially the design) and how I think it should be implemented.
Whitelist functionality
Current behavior
For the
announce
request, the request is rejected immediately (in the controller) and the client receives an error.For the
scrape
request, there is no check at the controller level. All requests reach the domain layer. The scrape handler includes all the requested torrents in the response. However, torrents that have not been included in the whitelist return zeroed stats.Proposal for a behavior change (not implemented in this issue)
For me, It's confusing to return always data for non-allowed torrents because there is no way to know if that torrent is not allow or there is no data for the torrent because there are no peers yet.
I think there are some alternatives:
I have asked ChatGTP (see the response at the end of the issue description) and It said the most common approach is option 2. Apparently (I have not confirm it) OpenTracker and XBT Tracker do that.
I also think option 2 is the best because:
NOTE: That would be a breaking change because clients always expect to receive one item for each torrent in the response. If we decide to change it it should be done in the next major version.
Whitelist design
I'm going to explain how the functionality is implemented now and the changes I want to make immediately. Those changes are not intended to implement the proposal for a behavior change described above. There are independent of that change in the functionality.
Current design
Proposal for a design change
There are some things I would like to refactor:
servers::udp::handlers::{announce, scrape}
.udp-tracker-core
services::announce::invoke()
in the HTTP tracker to thehttp-tracker-core
package.services::announce::invoke()
in the UDP tracker to theudp-tracker-core
package.http-tracker-core
andudp-tracker-core
packages.Result<AnnounceData, AnnounceError>
when the torrent is not included in the whitelist.Result<ScrapeData, ScrapeError>
so we are able to return errors in the future without breaking the public API.Add version module also for the UDP tracker. I don't see any reason to usev1
in the http tracker but not in the UDP tracker.cc @da2ce7
Part of the ChatGTP response about how scrape works for listed trackers:
The text was updated successfully, but these errors were encountered: