forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: [torrust#260] crate docs for shared mod
- Loading branch information
1 parent
d164f90
commit b7e78ab
Showing
15 changed files
with
400 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
"leechers", | ||
"libtorrent", | ||
"Lphant", | ||
"metainfo", | ||
"middlewares", | ||
"mockall", | ||
"multimap", | ||
|
Binary file not shown.
10 changes: 10 additions & 0 deletions
10
docs/media/mandelbrot_2048x2048_infohash_v1.png.torrent.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"created by": "qBittorrent v4.4.1", | ||
"creation date": 1679674628, | ||
"info": { | ||
"length": 172204, | ||
"name": "mandelbrot_2048x2048.png", | ||
"piece length": 16384, | ||
"pieces": "<hex>7D 91 71 0D 9D 4D BA 88 9B 54 20 54 D5 26 72 8D 5A 86 3F E1 21 DF 77 C7 F7 BB 6C 77 96 21 66 25 38 C5 D9 CD AB 8B 08 EF 8C 24 9B B2 F5 C4 CD 2A DF 0B C0 0C F0 AD DF 72 90 E5 B6 41 4C 23 6C 47 9B 8E 9F 46 AA 0C 0D 8E D1 97 FF EE 68 8B 5F 34 A3 87 D7 71 C5 A6 F9 8E 2E A6 31 7C BD F0 F9 E2 23 F9 CC 80 AF 54 00 04 F9 85 69 1C 77 89 C1 76 4E D6 AA BF 61 A6 C2 80 99 AB B6 5F 60 2F 40 A8 25 BE 32 A3 3D 9D 07 0C 79 68 98 D4 9D 63 49 AF 20 58 66 26 6F 98 6B 6D 32 34 CD 7D 08 15 5E 1A D0 00 09 57 AB 30 3B 20 60 C1 DC 12 87 D6 F3 E7 45 4F 70 67 09 36 31 55 F2 20 F6 6C A5 15 6F 2C 89 95 69 16 53 81 7D 31 F1 B6 BD 37 42 CC 11 0B B2 FC 2B 49 A5 85 B6 FC 76 74 44 93</hex>" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,56 @@ | ||
//! `BitTorrent` protocol primitive types | ||
//! | ||
//! [BEP 3. The `BitTorrent` Protocol Specification](https://www.bittorrent.org/beps/bep_0003.html) | ||
use aquatic_udp_protocol::{AnnounceEvent, NumberOfBytes}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// The maximum number of torrents that can be returned in an `scrape` response. | ||
/// It's also the maximum number of peers returned in an `announce` response. | ||
/// | ||
/// The [BEP 15. UDP Tracker Protocol for `BitTorrent`](https://www.bittorrent.org/beps/bep_0015.html) | ||
/// defines this limit: | ||
/// | ||
/// "Up to about 74 torrents can be scraped at once. A full scrape can't be done | ||
/// with this protocol." | ||
/// | ||
/// The [BEP 48. Tracker Protocol Extension: Scrape](https://www.bittorrent.org/beps/bep_0048.html) | ||
/// does not specifically mention this limit, but the limit is being used for | ||
/// both the UDP and HTTP trackers since it's applied at the domain level. | ||
pub const MAX_SCRAPE_TORRENTS: u8 = 74; | ||
|
||
/// HTTP tracker authentication key length. | ||
/// | ||
/// See function to [`generate`](crate::tracker::auth::generate) the | ||
/// [`ExpiringKeys`](crate::tracker::auth::ExpiringKey) for more information. | ||
pub const AUTH_KEY_LENGTH: usize = 32; | ||
|
||
#[repr(u32)] | ||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)] | ||
pub enum Actions { | ||
enum Actions { | ||
// todo: it seems this enum is not used anywhere. Values match the ones in | ||
// aquatic_udp_protocol::request::Request::from_bytes. | ||
Connect = 0, | ||
Announce = 1, | ||
Scrape = 2, | ||
Error = 3, | ||
} | ||
|
||
/// Announce events. Described on the | ||
/// [BEP 3. The `BitTorrent` Protocol Specification](https://www.bittorrent.org/beps/bep_0003.html) | ||
#[derive(Serialize, Deserialize)] | ||
#[serde(remote = "AnnounceEvent")] | ||
pub enum AnnounceEventDef { | ||
/// The peer has started downloading the torrent. | ||
Started, | ||
/// The peer has ceased downloading the torrent. | ||
Stopped, | ||
/// The peer has completed downloading the torrent. | ||
Completed, | ||
/// This is one of the announcements done at regular intervals. | ||
None, | ||
} | ||
|
||
/// Number of bytes downloaded, uploaded or pending to download (left) by the peer. | ||
#[derive(Serialize, Deserialize)] | ||
#[serde(remote = "NumberOfBytes")] | ||
pub struct NumberOfBytesDef(pub i64); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
//! Common code for the `BitTorrent` protocol. | ||
pub mod common; | ||
pub mod info_hash; |
Oops, something went wrong.