From c021496a558ea1e8e5b38810f3d06b56b5219de4 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 8 May 2023 15:21:06 +0200 Subject: [PATCH 1/3] refactor: uopdate NotFound error type --- src/client/channel.rs | 41 ++++++++++++----------- src/client/channel_rss.rs | 10 +++--- src/client/mod.rs | 17 ++++++---- src/client/music_details.rs | 23 ++++++++----- src/client/playlist.rs | 2 +- src/client/response/mod.rs | 24 +++++++------ src/client/url_resolver.rs | 24 +++++++------ src/client/video_details.rs | 27 +++++++-------- src/error.rs | 21 +++++++----- tests/youtube.rs | 67 ++++++++----------------------------- 10 files changed, 119 insertions(+), 137 deletions(-) diff --git a/src/client/channel.rs b/src/client/channel.rs index 5510037..0580f2f 100644 --- a/src/client/channel.rs +++ b/src/client/channel.rs @@ -164,7 +164,7 @@ impl MapResponse>> for response::Channel { lang: Language, _deobf: Option<&crate::deobfuscate::DeobfData>, ) -> Result>>, ExtractionError> { - let content = map_channel_content(self.contents, self.alerts)?; + let content = map_channel_content(id, self.contents, self.alerts)?; let channel_data = map_channel( MapChannelData { @@ -207,7 +207,7 @@ impl MapResponse>> for response::Channel { lang: Language, _deobf: Option<&crate::deobfuscate::DeobfData>, ) -> Result>>, ExtractionError> { - let content = map_channel_content(self.contents, self.alerts)?; + let content = map_channel_content(id, self.contents, self.alerts)?; let channel_data = map_channel( MapChannelData { @@ -244,7 +244,7 @@ impl MapResponse> for response::Channel { lang: Language, _deobf: Option<&crate::deobfuscate::DeobfData>, ) -> Result>, ExtractionError> { - let content = map_channel_content(self.contents, self.alerts)?; + let content = map_channel_content(id, self.contents, self.alerts)?; let channel_data = map_channel( MapChannelData { header: self.header, @@ -304,22 +304,21 @@ fn map_channel( id: &str, lang: Language, ) -> Result>, ExtractionError> { - let header = d - .header - .ok_or(ExtractionError::ContentUnavailable(Cow::Borrowed( - "channel not found", - )))?; + let header = d.header.ok_or_else(|| ExtractionError::NotFound { + id: id.to_owned(), + msg: "no header".into(), + })?; let metadata = d .metadata - .ok_or(ExtractionError::ContentUnavailable(Cow::Borrowed( - "channel not found", - )))? + .ok_or_else(|| ExtractionError::NotFound { + id: id.to_owned(), + msg: "no metadata".into(), + })? .channel_metadata_renderer; - let microformat = d - .microformat - .ok_or(ExtractionError::ContentUnavailable(Cow::Borrowed( - "channel not found", - )))?; + let microformat = d.microformat.ok_or_else(|| ExtractionError::NotFound { + id: id.to_owned(), + msg: "no microformat".into(), + })?; if metadata.external_id != id { return Err(ExtractionError::WrongResult(format!( @@ -405,6 +404,7 @@ struct MappedChannelContent { } fn map_channel_content( + id: &str, contents: Option, alerts: Option>, ) -> Result { @@ -412,9 +412,10 @@ fn map_channel_content( Some(contents) => { let tabs = contents.two_column_browse_results_renderer.contents; if tabs.is_empty() { - return Err(ExtractionError::ContentUnavailable( - "channel not found".into(), - )); + return Err(ExtractionError::NotFound { + id: id.to_owned(), + msg: "no tabs".into(), + }); } let cmp_url_suffix = |endpoint: &response::channel::ChannelTabEndpoint, @@ -470,7 +471,7 @@ fn map_channel_content( has_live, }) } - None => Err(response::alerts_to_err(alerts)), + None => Err(response::alerts_to_err(id, alerts)), } } diff --git a/src/client/channel_rss.rs b/src/client/channel_rss.rs index d28f81e..0eb204d 100644 --- a/src/client/channel_rss.rs +++ b/src/client/channel_rss.rs @@ -16,18 +16,20 @@ impl RustyPipeQuery { /// Fetching RSS feeds is a lot faster than querying the InnerTube API, so this method is great /// for checking a lot of channels or implementing a subscription feed. pub async fn channel_rss>(&self, channel_id: S) -> Result { + let channel_id = channel_id.as_ref(); let url = format!( "https://www.youtube.com/feeds/videos.xml?channel_id={}", - channel_id.as_ref() + channel_id, ); let xml = self .client .http_request_txt(self.client.inner.http.get(&url).build()?) .await .map_err(|e| match e { - Error::HttpStatus(404, _) => Error::Extraction( - ExtractionError::ContentUnavailable("Channel not found".into()), - ), + Error::HttpStatus(404, _) => Error::Extraction(ExtractionError::NotFound { + id: channel_id.to_owned(), + msg: "404".into(), + }), _ => e, })?; diff --git a/src/client/mod.rs b/src/client/mod.rs index 36d2d4a..ae339b6 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -1106,17 +1106,20 @@ impl RustyPipeQuery { if status.is_client_error() || status.is_server_error() { let error_msg = serde_json::from_str::(&resp_str) - .map(|r| r.error.message) - .unwrap_or_default(); + .map(|r| Cow::from(r.error.message)); return match status { - StatusCode::NOT_FOUND => Err(Error::Extraction( - ExtractionError::ContentUnavailable(error_msg.into()), - )), + StatusCode::NOT_FOUND => Err(Error::Extraction(ExtractionError::NotFound { + id: id.to_owned(), + msg: error_msg.unwrap_or("404".into()), + })), StatusCode::BAD_REQUEST => Err(Error::Extraction(ExtractionError::BadRequest( - error_msg.into(), + error_msg.unwrap_or_default(), ))), - _ => Err(Error::HttpStatus(status.as_u16(), error_msg.into())), + _ => Err(Error::HttpStatus( + status.as_u16(), + error_msg.unwrap_or_default(), + )), }; } diff --git a/src/client/music_details.rs b/src/client/music_details.rs index 66bfb53..0d35eae 100644 --- a/src/client/music_details.rs +++ b/src/client/music_details.rs @@ -193,9 +193,10 @@ impl MapResponse for response::MusicDetails { } } - let content = content.ok_or(ExtractionError::ContentUnavailable(Cow::Borrowed( - "track not found", - )))?; + let content = content.ok_or_else(|| ExtractionError::NotFound { + id: id.to_owned(), + msg: "no content".into(), + })?; let track_item = content .contents .c @@ -233,7 +234,7 @@ impl MapResponse for response::MusicDetails { impl MapResponse> for response::MusicDetails { fn map_response( self, - _id: &str, + id: &str, lang: Language, _deobf: Option<&crate::deobfuscate::DeobfData>, ) -> Result>, ExtractionError> { @@ -247,9 +248,10 @@ impl MapResponse> for response::MusicDetails { let content = tabs .into_iter() .find_map(|t| t.tab_renderer.content) - .ok_or(ExtractionError::ContentUnavailable(Cow::Borrowed( - "radio unavailable", - )))? + .ok_or_else(|| ExtractionError::NotFound { + id: id.to_owned(), + msg: "no content".into(), + })? .music_queue_renderer .content .playlist_panel_renderer; @@ -292,7 +294,7 @@ impl MapResponse> for response::MusicDetails { impl MapResponse for response::MusicLyrics { fn map_response( self, - _id: &str, + id: &str, _lang: Language, _deobf: Option<&crate::deobfuscate::DeobfData>, ) -> Result, ExtractionError> { @@ -305,7 +307,10 @@ impl MapResponse for response::MusicLyrics { .find_map(|item| item.music_description_shelf_renderer) }) .ok_or(match self.contents.message_renderer { - Some(msg) => ExtractionError::ContentUnavailable(Cow::Owned(msg.text)), + Some(msg) => ExtractionError::NotFound { + id: id.to_owned(), + msg: msg.text.into(), + }, None => ExtractionError::InvalidData(Cow::Borrowed("no content")), })?; diff --git a/src/client/playlist.rs b/src/client/playlist.rs index 5fed815..385f3a1 100644 --- a/src/client/playlist.rs +++ b/src/client/playlist.rs @@ -62,7 +62,7 @@ impl MapResponse for response::Playlist { ) -> Result, ExtractionError> { let (contents, header) = match (self.contents, self.header) { (Some(contents), Some(header)) => (contents, header), - _ => return Err(response::alerts_to_err(self.alerts)), + _ => return Err(response::alerts_to_err(id, self.alerts)), }; let video_items = contents diff --git a/src/client/response/mod.rs b/src/client/response/mod.rs index 551fd8c..b321dcc 100644 --- a/src/client/response/mod.rs +++ b/src/client/response/mod.rs @@ -353,16 +353,18 @@ impl From for crate::model::Verification { } } -pub(crate) fn alerts_to_err(alerts: Option>) -> ExtractionError { - match alerts { - Some(alerts) => ExtractionError::ContentUnavailable( - alerts - .into_iter() - .map(|a| a.alert_renderer.text) - .collect::>() - .join(" ") - .into(), - ), - None => ExtractionError::ContentUnavailable("content not found".into()), +pub(crate) fn alerts_to_err(id: &str, alerts: Option>) -> ExtractionError { + ExtractionError::NotFound { + id: id.to_owned(), + msg: alerts + .map(|alerts| { + alerts + .into_iter() + .map(|a| a.alert_renderer.text) + .collect::>() + .join(" ") + .into() + }) + .unwrap_or_default(), } } diff --git a/src/client/url_resolver.rs b/src/client/url_resolver.rs index f549d34..cecb849 100644 --- a/src/client/url_resolver.rs +++ b/src/client/url_resolver.rs @@ -163,18 +163,22 @@ impl RustyPipeQuery { .await { Ok(target) => Ok(target), - Err(Error::Extraction(ExtractionError::ContentUnavailable(e))) => { - match util::VIDEO_ID_REGEX.is_match(id) { - true => Ok(UrlTarget::Video { - id: id.to_owned(), - start_time: get_start_time(), - }), - false => Err(Error::Extraction( - ExtractionError::ContentUnavailable(e), - )), + Err(e) => { + if matches!( + e, + Error::Extraction(ExtractionError::NotFound { .. }) + ) { + match util::VIDEO_ID_REGEX.is_match(id) { + true => Ok(UrlTarget::Video { + id: id.to_owned(), + start_time: get_start_time(), + }), + false => Err(e), + } + } else { + Err(e) } } - Err(e) => Err(e), } } else if util::VIDEO_ID_REGEX.is_match(id) { Ok(UrlTarget::Video { diff --git a/src/client/video_details.rs b/src/client/video_details.rs index 68754f1..8bf791c 100644 --- a/src/client/video_details.rs +++ b/src/client/video_details.rs @@ -1,5 +1,3 @@ -use std::borrow::Cow; - use serde::Serialize; use crate::{ @@ -87,16 +85,16 @@ impl MapResponse for response::VideoDetails { ) -> Result, ExtractionError> { let mut warnings = Vec::new(); - let contents = self - .contents - .ok_or(ExtractionError::ContentUnavailable(Cow::Borrowed( - "Video not found", - )))?; + let contents = self.contents.ok_or_else(|| ExtractionError::NotFound { + id: id.to_owned(), + msg: "no content".into(), + })?; let current_video_endpoint = self.current_video_endpoint - .ok_or(ExtractionError::ContentUnavailable(Cow::Borrowed( - "Video not found", - )))?; + .ok_or_else(|| ExtractionError::NotFound { + id: id.to_owned(), + msg: "no current_video_endpoint".into(), + })?; let video_id = current_video_endpoint.watch_endpoint.video_id; if id != video_id { @@ -110,9 +108,10 @@ impl MapResponse for response::VideoDetails { .results .results .contents - .ok_or(ExtractionError::ContentUnavailable(Cow::Borrowed( - "Video not found", - )))?; + .ok_or_else(|| ExtractionError::NotFound { + id: id.into(), + msg: "no primary_results".into(), + })?; warnings.append(&mut primary_results.warnings); let mut primary_info = None; @@ -585,7 +584,7 @@ mod tests { let err = details.map_response("", Language::En, None).unwrap_err(); assert!(matches!( err, - crate::error::ExtractionError::ContentUnavailable(_) + crate::error::ExtractionError::NotFound { .. } )) } diff --git a/src/error.rs b/src/error.rs index 32461cc..a5b4cc2 100644 --- a/src/error.rs +++ b/src/error.rs @@ -30,21 +30,26 @@ pub enum ExtractionError { /// - Deletion/Censorship /// - Private video that requires a Google account /// - DRM (Movies and TV shows) - #[error("Video cant be played because it is {reason}. Reason (from YT): {msg}")] + #[error("video cant be played because it is {reason}. Reason (from YT): {msg}")] VideoUnavailable { /// Reason why the video could not be extracted reason: UnavailabilityReason, /// The error message as returned from YouTube msg: String, }, - /// Content is not available / does not exist - #[error("Content is not available. Reason: {0}")] - ContentUnavailable(Cow<'static, str>), + /// Content with the given ID does not exist + #[error("content `{id}` was not found ({msg})")] + NotFound { + /// ID of the requested content + id: String, + /// Error message + msg: Cow<'static, str>, + }, /// Bad request (Error 400 from YouTube), probably invalid input parameters - #[error("Bad request. Reason: {0}")] + #[error("bad request ({0})")] BadRequest(Cow<'static, str>), /// YouTube returned data that could not be deserialized or parsed - #[error("got invalid data from YT: {0}")] + #[error("invalid data from YT: {0}")] InvalidData(Cow<'static, str>), /// Error deobfuscating YouTube's URL signatures #[error("deobfuscation error: {0}")] @@ -54,7 +59,7 @@ pub enum ExtractionError { /// Specifically YouTube may return this video , /// which is a 5 minute error message, instead of the requested video when using an outdated /// Android client. - #[error("got wrong result from YT: {0}")] + #[error("wrong result from YT: {0}")] WrongResult(String), /// YouTube redirects you to another content ID /// @@ -64,7 +69,7 @@ pub enum ExtractionError { /// Warnings occurred during deserialization/mapping /// /// This error is only returned in strict mode. - #[error("Warnings during deserialization/mapping")] + #[error("warnings during deserialization/mapping")] DeserializationWarnings, } diff --git a/tests/youtube.rs b/tests/youtube.rs index 0fb95f7..928206d 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -383,10 +383,7 @@ fn playlist_not_found(rp: RustyPipe) { .unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } @@ -729,10 +726,7 @@ fn get_video_details_not_found(rp: RustyPipe) { let err = tokio_test::block_on(rp.query().video_details("abcdefgLi5X")).unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ) } @@ -973,10 +967,7 @@ fn channel_not_found(#[case] id: &str, rp: RustyPipe) { let err = tokio_test::block_on(rp.query().channel_videos(&id)).unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } @@ -1017,10 +1008,7 @@ mod channel_rss { tokio_test::block_on(rp.query().channel_rss("UCHnyfMqiRRG1u-2MsSQLbXZ")).unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {}", err ); @@ -1164,7 +1152,7 @@ fn resolve_channel_not_found(rp: RustyPipe) { assert!(matches!( err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) + Error::Extraction(ExtractionError::NotFound { .. }) )); } @@ -1288,10 +1276,7 @@ fn music_playlist_not_found(rp: RustyPipe) { .unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } @@ -1337,10 +1322,7 @@ fn music_album_not_found(rp: RustyPipe) { let err = tokio_test::block_on(rp.query().music_album("MPREb_nlBWQROfvjoz")).unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } @@ -1430,10 +1412,7 @@ fn music_artist_not_found(rp: RustyPipe) { .unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } @@ -1857,10 +1836,7 @@ fn music_lyrics_not_found(rp: RustyPipe) { let err = tokio_test::block_on(rp.query().music_lyrics(&track.lyrics_id.unwrap())).unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } @@ -1970,10 +1946,7 @@ fn music_details_not_found(rp: RustyPipe) { let err = tokio_test::block_on(rp.query().music_details("7nigXQS1XbZ")).unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } @@ -1989,10 +1962,7 @@ fn music_radio_track_not_found(rp: RustyPipe) { let err = tokio_test::block_on(rp.query().music_radio_track("7nigXQS1XbZ")).unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } @@ -2016,10 +1986,7 @@ fn music_radio_playlist_not_found(rp: RustyPipe) { if let Err(err) = res { assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } @@ -2038,10 +2005,7 @@ fn music_radio_not_found(rp: RustyPipe) { tokio_test::block_on(rp.query().music_radio("RDEM_Ktu-TilkxtLvmc9wXZZZZ")).unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } @@ -2195,10 +2159,7 @@ fn music_genre_not_found(rp: RustyPipe) { let err = tokio_test::block_on(rp.query().music_genre("ggMPOg1uX1JOQWZFeDByc2zz")).unwrap_err(); assert!( - matches!( - err, - Error::Extraction(ExtractionError::ContentUnavailable(_)) - ), + matches!(err, Error::Extraction(ExtractionError::NotFound { .. })), "got: {err}" ); } From a51e42f563a37c304d197bfd3e6e891f911ff0a7 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 8 May 2023 16:40:37 +0200 Subject: [PATCH 2/3] feat: add HTTP request timeout --- src/client/mod.rs | 99 +++++++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 41 deletions(-) diff --git a/src/client/mod.rs b/src/client/mod.rs index ae339b6..743f6d4 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -23,14 +23,14 @@ mod video_details; mod channel_rss; use std::sync::Arc; -use std::{borrow::Cow, fmt::Debug}; +use std::{borrow::Cow, fmt::Debug, time::Duration}; use once_cell::sync::Lazy; use rand::Rng; use regex::Regex; use reqwest::{header, Client, ClientBuilder, Request, RequestBuilder, Response, StatusCode}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use time::{Duration, OffsetDateTime}; +use time::OffsetDateTime; use tokio::sync::RwLock; use crate::{ @@ -241,15 +241,30 @@ struct RustyPipeOpts { /// Builder to construct a new RustyPipe client pub struct RustyPipeBuilder { - storage: Option>, - no_storage: bool, - reporter: Option>, - no_reporter: bool, + storage: DefaultOpt>, + reporter: DefaultOpt>, n_http_retries: u32, + timeout: DefaultOpt, user_agent: Option, default_opts: RustyPipeOpts, } +enum DefaultOpt { + Some(T), + None, + Default, +} + +impl DefaultOpt { + fn or_default T>(self, f: F) -> Option { + match self { + DefaultOpt::Some(x) => Some(x), + DefaultOpt::None => None, + DefaultOpt::Default => Some(f()), + } + } +} + /// RustyPipe query object /// /// Contains a reference to the RustyPipe client as well as query-specific @@ -308,7 +323,7 @@ impl CacheEntry { fn get(&self) -> Option<&T> { match self { CacheEntry::Some { last_update, data } => { - if last_update < &(OffsetDateTime::now_utc() - Duration::hours(24)) { + if last_update < &(OffsetDateTime::now_utc() - time::Duration::hours(24)) { None } else { Some(data) @@ -341,10 +356,9 @@ impl RustyPipeBuilder { pub fn new() -> Self { RustyPipeBuilder { default_opts: RustyPipeOpts::default(), - storage: None, - no_storage: false, - reporter: None, - no_reporter: false, + storage: DefaultOpt::Default, + reporter: DefaultOpt::Default, + timeout: DefaultOpt::Default, n_http_retries: 2, user_agent: None, } @@ -352,15 +366,19 @@ impl RustyPipeBuilder { /// Returns a new, configured RustyPipe instance. pub fn build(self) -> RustyPipe { - let http = ClientBuilder::new() + let mut client_builder = ClientBuilder::new() .user_agent(self.user_agent.unwrap_or_else(|| DEFAULT_UA.to_owned())) .gzip(true) .brotli(true) - .redirect(reqwest::redirect::Policy::none()) - .build() - .unwrap(); + .redirect(reqwest::redirect::Policy::none()); - let cdata = if let Some(storage) = &self.storage { + if let Some(timeout) = self.timeout.or_default(|| Duration::from_secs(10)) { + client_builder = client_builder.timeout(timeout); + } + + let http = client_builder.build().unwrap(); + + let cdata = if let DefaultOpt::Some(storage) = &self.storage { if let Some(data) = storage.read() { match serde_json::from_str::(&data) { Ok(data) => data, @@ -379,22 +397,8 @@ impl RustyPipeBuilder { RustyPipe { inner: Arc::new(RustyPipeRef { http, - storage: if self.no_storage { - None - } else { - Some( - self.storage - .unwrap_or_else(|| Box::::default()), - ) - }, - reporter: if self.no_reporter { - None - } else { - Some( - self.reporter - .unwrap_or_else(|| Box::::default()), - ) - }, + storage: self.storage.or_default(|| Box::::default()), + reporter: self.reporter.or_default(|| Box::::default()), n_http_retries: self.n_http_retries, consent_cookie: format!( "{}={}{}", @@ -418,15 +422,13 @@ impl RustyPipeBuilder { /// /// **Default value**: [`FileStorage`] in `rustypipe_cache.json` pub fn storage(mut self, storage: Box) -> Self { - self.storage = Some(storage); - self.no_storage = false; + self.storage = DefaultOpt::Some(storage); self } /// Disable cache storage pub fn no_storage(mut self) -> Self { - self.storage = None; - self.no_storage = true; + self.storage = DefaultOpt::None; self } @@ -434,15 +436,30 @@ impl RustyPipeBuilder { /// /// **Default value**: [`FileReporter`] creating reports in `./rustypipe_reports` pub fn reporter(mut self, reporter: Box) -> Self { - self.reporter = Some(reporter); - self.no_reporter = false; + self.reporter = DefaultOpt::Some(reporter); self } /// Disable the creation of report files in case of errors and warnings. pub fn no_reporter(mut self) -> Self { - self.reporter = None; - self.no_reporter = true; + self.reporter = DefaultOpt::None; + self + } + + /// Enable a HTTP request timeout + /// + /// The timeout is applied from when the request starts connecting until the + /// response body has finished. + /// + /// **Default value**: 10s + pub fn timeout(mut self, timeout: Duration) -> Self { + self.timeout = DefaultOpt::Some(timeout); + self + } + + /// Disable the HTTP request timeout. + pub fn no_timeout(mut self) -> Self { + self.timeout = DefaultOpt::None; self } @@ -576,7 +593,7 @@ impl RustyPipe { let ms = util::retry_delay(n, 1000, 60000, 3); log::warn!("Retry attempt #{}. Error: {}. Waiting {} ms", n, emsg, ms); - tokio::time::sleep(std::time::Duration::from_millis(ms.into())).await; + tokio::time::sleep(Duration::from_millis(ms.into())).await; last_res = Some(res); } From c15d46e0c4a3ae8b6123f1c681c04d6667745c4e Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 8 May 2023 17:01:51 +0200 Subject: [PATCH 3/3] feat: add all request tls options --- .woodpecker.yml | 4 +- Cargo.toml | 5 +- Justfile | 8 +- cli/Cargo.lock | 1524 ----------------------------------------- cli/Cargo.toml | 42 +- downloader/Cargo.toml | 10 +- 6 files changed, 52 insertions(+), 1541 deletions(-) delete mode 100644 cli/Cargo.lock diff --git a/.woodpecker.yml b/.woodpecker.yml index 217ef88..47541f7 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -6,5 +6,5 @@ pipeline: commands: - rustup component add rustfmt clippy - cargo fmt --all --check - - cargo clippy --all --all-features -- -D warnings - - cargo test --workspace + - cargo clippy --all --features=rss -- -D warnings + - cargo test --features=rss --workspace diff --git a/Cargo.toml b/Cargo.toml index c8937b3..fa5105c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,8 +17,11 @@ default = ["default-tls"] rss = ["quick-xml"] -# Reqwest TLS +# Reqwest TLS options default-tls = ["reqwest/default-tls"] +native-tls = ["reqwest/native-tls"] +native-tls-alpn = ["reqwest/native-tls-alpn"] +native-tls-vendored = ["reqwest/native-tls-vendored"] rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"] rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"] diff --git a/Justfile b/Justfile index 031c759..9852566 100644 --- a/Justfile +++ b/Justfile @@ -1,18 +1,18 @@ test: - cargo test --all-features + cargo test --features=rss unittest: - cargo test --all-features --lib + cargo test --features=rss --lib testyt: - cargo test --all-features --test youtube + cargo test --features=rss --test youtube testyt10: #!/usr/bin/env bash set -e for i in {1..10}; do \ echo "---TEST RUN $i---"; \ - cargo test --all-features --test youtube; \ + cargo test --features=rss --test youtube; \ done testintl: diff --git a/cli/Cargo.lock b/cli/Cargo.lock deleted file mode 100644 index eac6fef..0000000 --- a/cli/Cargo.lock +++ /dev/null @@ -1,1524 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "alloc-no-stdlib" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ef4730490ad1c4eae5c4325b2a95f521d023e5c885853ff7aca0a6a1631db3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697ed7edc0f1711de49ce108c541623a0af97c6c60b2f6e2b65229847ac843c2" -dependencies = [ - "alloc-no-stdlib", -] - -[[package]] -name = "anyhow" -version = "1.0.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c794e162a5eff65c72ef524dfe393eb923c354e350bb78b9c7383df13f3bc142" - -[[package]] -name = "async-compression" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345fd392ab01f746c717b1357165b76f0b67a60192007b234058c9045fdcf695" -dependencies = [ - "brotli", - "flate2", - "futures-core", - "memchr", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "async-trait" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "brotli" -version = "3.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - -[[package]] -name = "bumpalo" -version = "3.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" - -[[package]] -name = "bytes" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6127248204b9aba09a362f6c930ef6a78f2c1b2215f8a7b398c06e1083f17af0" -dependencies = [ - "js-sys", - "num-integer", - "num-traits", - "serde", - "time 0.1.44", - "wasm-bindgen", - "winapi 0.3.9", -] - -[[package]] -name = "console" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89eab4d20ce20cea182308bca13088fecea9c05f6776cf287205d41a0ed3c847" -dependencies = [ - "encode_unicode", - "libc", - "once_cell", - "terminal_size", - "unicode-width", - "winapi 0.3.9", -] - -[[package]] -name = "copy_dir" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4281031634644843bd2f5aa9c48cf98fc48d6b083bd90bb11becf10deaf8b0" -dependencies = [ - "walkdir", -] - -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "darling" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4529658bdda7fd6769b8614be250cdcfc3aeb0ee72fe66f9e41e5e5eb73eac02" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "649c91bc01e8b1eac09fb91e8dbc7d517684ca6be8ebc75bb9cafc894f9fdb6f" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc69c5bfcbd2fc09a0f38451d2daf0e372e367986a83906d1b0dbc88134fb5" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "encoding_rs" -version = "0.8.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "fancy-regex" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0678ab2d46fa5195aaf59ad034c083d351377d4af57f3e073c074d0da3e3c766" -dependencies = [ - "bit-set", - "regex", -] - -[[package]] -name = "fastrand" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" -dependencies = [ - "instant", -] - -[[package]] -name = "flate2" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "form_urlencoded" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" -dependencies = [ - "matches", - "percent-encoding", -] - -[[package]] -name = "futures" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" - -[[package]] -name = "futures-executor" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" - -[[package]] -name = "futures-macro" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" - -[[package]] -name = "futures-task" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" - -[[package]] -name = "futures-util" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "h2" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "http" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "hyper" -version = "0.14.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "indexmap" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" -dependencies = [ - "autocfg", - "hashbrown", - "serde", -] - -[[package]] -name = "indicatif" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc42b206e70d86ec03285b123e65a5458c92027d1fb2ae3555878b8113b3ddf" -dependencies = [ - "console", - "number_prefix", - "unicode-width", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "ipnet" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" - -[[package]] -name = "itoa" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" - -[[package]] -name = "js-sys" -version = "0.3.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.127" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "505e71a4706fa491e9b1b55f51b95d4037d0821ee40131190475f692b35b009b" - -[[package]] -name = "libquickjs-sys" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f0b24e9bd171b75ae0295bd428fb8fe58410fb23156e5f34a4657a70c3cee96" -dependencies = [ - "cc", - "copy_dir", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "miniz_oxide" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" -dependencies = [ - "libc", - "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", -] - -[[package]] -name = "native-tls" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - -[[package]] -name = "once_cell" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" - -[[package]] -name = "openssl" -version = "0.10.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "proc-macro2" -version = "1.0.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quick-js" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19cb4cefcb00f4ab9b332664d06005a74f582ac16aa959c6ad5912957bd83e5f" -dependencies = [ - "libquickjs-sys", - "once_cell", -] - -[[package]] -name = "quote" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "reqwest" -version = "0.11.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" -dependencies = [ - "async-compression", - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-tls", - "ipnet", - "js-sys", - "lazy_static", - "log", - "mime", - "native-tls", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-native-tls", - "tokio-util", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - -[[package]] -name = "rusty-tube" -version = "0.1.0" -dependencies = [ - "anyhow", - "async-trait", - "chrono", - "fancy-regex", - "futures", - "indicatif", - "log", - "once_cell", - "quick-js", - "rand", - "reqwest", - "serde", - "serde_json", - "serde_with", - "thiserror", - "tokio", - "url", -] - -[[package]] -name = "rusty-tube-cli" -version = "0.1.0" -dependencies = [ - "rusty-tube", -] - -[[package]] -name = "ryu" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" - -[[package]] -name = "schannel" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" -dependencies = [ - "lazy_static", - "windows-sys", -] - -[[package]] -name = "security-framework" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "serde" -version = "1.0.142" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e590c437916fb6b221e1d00df6e3294f3fccd70ca7e92541c475d6ed6ef5fee2" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.142" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34b5b8d809babe02f538c2cfec6f2c1ed10804c0e5a6a041a049a4f5588ccc2e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89df7a26519371a3cce44fbb914c2819c84d9b897890987fa3ab096491cc0ea8" -dependencies = [ - "base64", - "chrono", - "hex", - "indexmap", - "serde", - "serde_json", - "serde_with_macros", - "time 0.3.12", -] - -[[package]] -name = "serde_with_macros" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de337f322382fcdfbb21a014f7c224ee041a23785651db67b9827403178f698f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - -[[package]] -name = "slab" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" -dependencies = [ - "autocfg", -] - -[[package]] -name = "socket2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if", - "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi 0.3.9", -] - -[[package]] -name = "terminal_size" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "thiserror" -version = "1.0.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "time" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", -] - -[[package]] -name = "time" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74b7cc93fc23ba97fde84f7eea56c55d1ba183f495c6715defdfc7b9cb8c870f" -dependencies = [ - "itoa", - "js-sys", - "libc", - "num_threads", - "serde", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "tokio" -version = "1.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" -dependencies = [ - "autocfg", - "bytes", - "libc", - "memchr", - "mio", - "once_cell", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "winapi 0.3.9", -] - -[[package]] -name = "tokio-macros" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" - -[[package]] -name = "unicode-bidi" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" - -[[package]] -name = "unicode-ident" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" - -[[package]] -name = "unicode-normalization" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "url" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" -dependencies = [ - "form_urlencoded", - "idna", - "matches", - "percent-encoding", -] - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "walkdir" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780" -dependencies = [ - "kernel32-sys", - "winapi 0.2.8", -] - -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" - -[[package]] -name = "web-sys" -version = "0.3.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi 0.3.9", -] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0b59f37..b54fc74 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -3,16 +3,40 @@ name = "rustypipe-cli" version = "0.1.0" edition = "2021" +[features] +default = ["rustls-tls-native-roots"] + +# Reqwest TLS options +native-tls = [ + "reqwest/native-tls", + "rustypipe/native-tls", + "rustypipe-downloader/native-tls", +] +native-tls-alpn = [ + "reqwest/native-tls-alpn", + "rustypipe/native-tls-alpn", + "rustypipe-downloader/native-tls-alpn", +] +native-tls-vendored = [ + "reqwest/native-tls-vendored", + "rustypipe/native-tls-vendored", + "rustypipe-downloader/native-tls-vendored", +] +rustls-tls-webpki-roots = [ + "reqwest/rustls-tls-webpki-roots", + "rustypipe/rustls-tls-webpki-roots", + "rustypipe-downloader/rustls-tls-webpki-roots", +] +rustls-tls-native-roots = [ + "reqwest/rustls-tls-native-roots", + "rustypipe/rustls-tls-native-roots", + "rustypipe-downloader/rustls-tls-native-roots", +] + [dependencies] -rustypipe = { path = "../", default-features = false, features = [ - "rustls-tls-native-roots", -] } -rustypipe-downloader = { path = "../downloader", default-features = false, features = [ - "rustls-tls-native-roots", -] } -reqwest = { version = "0.11.11", default_features = false, features = [ - "rustls-tls-native-roots", -] } +rustypipe = { path = "../", default-features = false } +rustypipe-downloader = { path = "../downloader", default-features = false } +reqwest = { version = "0.11.11", default_features = false } tokio = { version = "1.20.0", features = ["macros", "rt-multi-thread"] } indicatif = "0.17.0" futures = "0.3.21" diff --git a/downloader/Cargo.toml b/downloader/Cargo.toml index 9f60764..3047ce0 100644 --- a/downloader/Cargo.toml +++ b/downloader/Cargo.toml @@ -4,8 +4,16 @@ version = "0.1.0" edition = "2021" [features] -# Reqwest TLS +default = ["default-tls"] + +# Reqwest TLS options default-tls = ["reqwest/default-tls", "rustypipe/default-tls"] +native-tls = ["reqwest/native-tls", "rustypipe/native-tls"] +native-tls-alpn = ["reqwest/native-tls-alpn", "rustypipe/native-tls-alpn"] +native-tls-vendored = [ + "reqwest/native-tls-vendored", + "rustypipe/native-tls-vendored", +] rustls-tls-webpki-roots = [ "reqwest/rustls-tls-webpki-roots", "rustypipe/rustls-tls-webpki-roots",