aquatic_ws_protocol: add documentation (as comments)

This commit is contained in:
Joakim Frostegård 2021-10-16 01:53:28 +02:00
parent c02d7f2113
commit 6624df1e44
3 changed files with 19 additions and 5 deletions

View file

@ -1,3 +1,15 @@
//! WebTorrent protocol implementation
//!
//! Typical announce workflow:
//! - Peer A sends announce request with info hash and offers
//! - Tracker sends on offers to other peers announcing with that info hash and
//! sends back announce response to peer A
//! - Tracker receives answers to those offers from other peers and send them
//! on to peer A
//!
//! Typical scrape workflow
//! - Peer sends scrape request and receives scrape response
pub mod common;
pub mod request;
pub mod response;

View file

@ -7,6 +7,7 @@ pub mod scrape;
pub use announce::*;
pub use scrape::*;
/// Message received by tracker
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InMessage {

View file

@ -12,14 +12,15 @@ pub use error::*;
pub use offer::*;
pub use scrape::*;
/// Message sent by tracker
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum OutMessage {
Offer(offer::MiddlemanOfferToPeer),
Answer(answer::MiddlemanAnswerToPeer),
AnnounceResponse(announce::AnnounceResponse),
ScrapeResponse(scrape::ScrapeResponse),
ErrorResponse(error::ErrorResponse),
Offer(MiddlemanOfferToPeer),
Answer(MiddlemanAnswerToPeer),
AnnounceResponse(AnnounceResponse),
ScrapeResponse(ScrapeResponse),
ErrorResponse(ErrorResponse),
}
impl OutMessage {