aquatic_ws_protocol: refactor, moving code into submodules

This commit is contained in:
Joakim Frostegård 2021-10-16 01:46:32 +02:00
parent 7c833958d8
commit 71c43aca47
11 changed files with 345 additions and 304 deletions

View file

@ -0,0 +1,24 @@
use std::borrow::Cow;
use serde::{Deserialize, Serialize};
use crate::common::*;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum ErrorResponseAction {
Announce,
Scrape,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ErrorResponse {
#[serde(rename = "failure reason")]
pub failure_reason: Cow<'static, str>,
/// Action of original request
#[serde(skip_serializing_if = "Option::is_none")]
pub action: Option<ErrorResponseAction>,
// Should not be renamed
#[serde(skip_serializing_if = "Option::is_none")]
pub info_hash: Option<InfoHash>,
}