Overview
The Torrust Tracker currently depends on aquatic_udp_protocol (from the aquatic project) for BitTorrent UDP tracker protocol types, serialization, and deserialization (BEP 15).
The upstream project has been inactive since February 2025. An open issue (aquatic#224) requesting a zerocopy 0.8 upgrade has received no response. We contributed a PR (aquatic#235) to apply the fix ourselves, but it has also remained unreviewed. This zerocopy version mismatch currently blocks torrust/torrust-tracker#1682 — a recurring dependabot PR that cannot be merged.
With 13 packages in this workspace directly depending on aquatic_udp_protocol, continuing to rely on an apparently unmaintained external crate is a maintenance and security risk.
The proposal is to own the UDP protocol implementation inside this workspace:
- Copy the current
aquatic_udp_protocol source into a new internal package (packages/aquatic-udp-protocol) under the terms of its Apache 2.0 license.
- Remove everything we do not use.
- Apply the
zerocopy 0.8 migration from our unmerged PR.
- Migrate
packages/udp-protocol to own all protocol types, absorbing the internal fork.
- Remove the interim fork once the migration is complete.
- Progressively redesign the types so they fit the Torrust Tracker domain model — while keeping the public surface backward-compatible throughout the transition.
Background
Why aquatic_udp_protocol?
It provides a complete, correct implementation of the BEP 15 UDP tracker wire protocol. The crate is small (~785 SLoC, 4 source files: common.rs, lib.rs, request.rs, response.rs), making an in-house replacement feasible.
License
aquatic_udp_protocol is published under Apache 2.0, which is fully compatible with the Torrust Tracker's AGPL-3.0 license. Apache 2.0 permits copying, modification, and redistribution provided that:
- The original copyright notice is preserved.
- A
NOTICE file is included (if the original has one).
- Modifications are clearly marked.
We will include the Apache 2.0 license text and copyright header in the new package.
Types currently used across the workspace
The following distinct types are imported from aquatic_udp_protocol in 26 source files across 13 packages:
| Category |
Types |
| Request types |
Request, ConnectRequest, AnnounceRequest, ScrapeRequest |
| Response types |
Response, ConnectResponse, AnnounceResponse<T>, ScrapeResponse, ErrorResponse |
| Identifiers |
TransactionId, ConnectionId, InfoHash, PeerId |
| Announce parameters |
AnnounceEvent, AnnounceActionPlaceholder, Port, PeerKey |
| Counters |
NumberOfBytes, NumberOfPeers, NumberOfDownloads |
| Scrape statistics |
TorrentScrapeStatistics |
| Address types |
Ipv4AddrBytes, Ipv6AddrBytes |
| Modules |
aquatic_udp_protocol::common |
Packages to update
| Package |
Path |
bittorrent-udp-protocol |
packages/udp-protocol |
bittorrent-http-protocol |
packages/http-protocol |
bittorrent-udp-tracker-core |
packages/udp-tracker-core |
bittorrent-tracker-core |
packages/tracker-core |
bittorrent-http-tracker-core |
packages/http-tracker-core |
bittorrent-tracker-primitives |
packages/primitives |
axum-http-tracker-server |
packages/axum-http-tracker-server |
axum-rest-tracker-api-server |
packages/axum-rest-tracker-api-server |
swarm-coordination-registry |
packages/swarm-coordination-registry |
torrent-repository-benchmarking |
packages/torrent-repository-benchmarking |
bittorrent-tracker-client |
packages/tracker-client |
tracker-client (console) |
console/tracker-client |
udp-tracker-server |
packages/udp-tracker-server |
Goals
Implementation Plan
Step 1: Create packages/aquatic-udp-protocol (internal fork)
Step 2: Strip unused items from the internal fork
Step 3: Apply the zerocopy 0.8 migration
Step 4: Migrate packages/udp-protocol to own the protocol types
Step 5: Redesign types to fit the Torrust Tracker domain model
Acceptance Criteria
References
cc @da2ce7 @cgbosse @greatest-ape
Overview
The Torrust Tracker currently depends on
aquatic_udp_protocol(from theaquaticproject) for BitTorrent UDP tracker protocol types, serialization, and deserialization (BEP 15).The upstream project has been inactive since February 2025. An open issue (aquatic#224) requesting a
zerocopy0.8 upgrade has received no response. We contributed a PR (aquatic#235) to apply the fix ourselves, but it has also remained unreviewed. Thiszerocopyversion mismatch currently blocks torrust/torrust-tracker#1682 — a recurring dependabot PR that cannot be merged.With 13 packages in this workspace directly depending on
aquatic_udp_protocol, continuing to rely on an apparently unmaintained external crate is a maintenance and security risk.The proposal is to own the UDP protocol implementation inside this workspace:
aquatic_udp_protocolsource into a new internal package (packages/aquatic-udp-protocol) under the terms of its Apache 2.0 license.zerocopy0.8 migration from our unmerged PR.packages/udp-protocolto own all protocol types, absorbing the internal fork.Background
Why
aquatic_udp_protocol?It provides a complete, correct implementation of the BEP 15 UDP tracker wire protocol. The crate is small (~785 SLoC, 4 source files:
common.rs,lib.rs,request.rs,response.rs), making an in-house replacement feasible.License
aquatic_udp_protocolis published under Apache 2.0, which is fully compatible with the Torrust Tracker's AGPL-3.0 license. Apache 2.0 permits copying, modification, and redistribution provided that:NOTICEfile is included (if the original has one).We will include the Apache 2.0 license text and copyright header in the new package.
Types currently used across the workspace
The following distinct types are imported from
aquatic_udp_protocolin 26 source files across 13 packages:Request,ConnectRequest,AnnounceRequest,ScrapeRequestResponse,ConnectResponse,AnnounceResponse<T>,ScrapeResponse,ErrorResponseTransactionId,ConnectionId,InfoHash,PeerIdAnnounceEvent,AnnounceActionPlaceholder,Port,PeerKeyNumberOfBytes,NumberOfPeers,NumberOfDownloadsTorrentScrapeStatisticsIpv4AddrBytes,Ipv6AddrBytesaquatic_udp_protocol::commonPackages to update
bittorrent-udp-protocolpackages/udp-protocolbittorrent-http-protocolpackages/http-protocolbittorrent-udp-tracker-corepackages/udp-tracker-corebittorrent-tracker-corepackages/tracker-corebittorrent-http-tracker-corepackages/http-tracker-corebittorrent-tracker-primitivespackages/primitivesaxum-http-tracker-serverpackages/axum-http-tracker-serveraxum-rest-tracker-api-serverpackages/axum-rest-tracker-api-serverswarm-coordination-registrypackages/swarm-coordination-registrytorrent-repository-benchmarkingpackages/torrent-repository-benchmarkingbittorrent-tracker-clientpackages/tracker-clienttracker-client(console)console/tracker-clientudp-tracker-serverpackages/udp-tracker-serverGoals
aquatic_udp_protocoldependency from the entire workspace.zerocopy0.8 migration (unblockingtorrust/torrust-tracker#1682).
linter allandcargo machetewith zero warnings after every step.Implementation Plan
Step 1: Create
packages/aquatic-udp-protocol(internal fork)aquatic_udp_protocol0.9.0 source (4 files) into a new workspace packagepackages/aquatic-udp-protocol.LICENSEfile and aNOTICEfile crediting the original author(Joakim Frostegård / greatest-ape).
README.mdexplaining that this is a temporary internal fork.Cargo.toml.(
aquatic_udp_protocol = { path = "../aquatic-udp-protocol" }).Step 2: Strip unused items from the internal fork
package in this workspace uses.
Step 3: Apply the
zerocopy0.8 migrationzerocopyto0.8in the fork'sCargo.toml.(aquatic#235).
rustflags(-D warnings, etc.).Step 4: Migrate
packages/udp-protocolto own the protocol typespackages/udp-protocol, replacing the internal fork.bittorrent-udp-tracker-protocolinstead ofaquatic_udp_protocol.packages/aquatic-udp-protocolfrom the workspace once no package depends on it.aquatic_udp_protocolfrom everyCargo.toml.Step 5: Redesign types to fit the Torrust Tracker domain model
is complete.
Acceptance Criteria
aquatic_udp_protocoldoes not appear in anyCargo.tomlor source file.cargo test --workspace).linter allexits with code0.cargo machetereports no unused dependencies.zerocopyversion across the workspace is0.8.packages/aquatic-udp-protocol) has been removed.References
zerocopyupgrade issue: Consider upgrading to the 0.8 version of Zerocopy greatest-ape/aquatic#224cc @da2ce7 @cgbosse @greatest-ape