pub struct ProxyConfig { /* private fields */ }Expand description
Proxy configuration supporting HTTP, HTTPS, and SOCKS5 proxies.
ยงExamples
use yt_dlp::client::proxy::{ProxyConfig, ProxyType};
// Simple HTTP proxy
let proxy = ProxyConfig::new(ProxyType::Http, "http://proxy.example.com:8080");
// SOCKS5 proxy with authentication
let proxy = ProxyConfig::new(ProxyType::Socks5, "socks5://proxy.example.com:1080")
.with_auth("username", "password");
// With no-proxy list
let proxy = ProxyConfig::new(ProxyType::Http, "http://proxy.example.com:8080")
.with_no_proxy(vec!["localhost".to_string(), "127.0.0.1".to_string()]);Implementationsยง
Sourceยงimpl ProxyConfig
impl ProxyConfig
Sourcepub fn with_no_proxy(self, no_proxy: Vec<String>) -> Self
pub fn with_no_proxy(self, no_proxy: Vec<String>) -> Self
Sourcepub fn proxy_type(&self) -> &ProxyType
pub fn proxy_type(&self) -> &ProxyType
Sourcepub fn username(&self) -> Option<&str>
pub fn username(&self) -> Option<&str>
Returns the username if authentication is configured.
ยงReturns
The proxy username, or None if no authentication is set.
Sourcepub fn password(&self) -> Option<&str>
pub fn password(&self) -> Option<&str>
Returns the password if authentication is configured.
ยงReturns
The proxy password, or None if no authentication is set.
Sourcepub fn build_url(&self) -> String
pub fn build_url(&self) -> String
Builds the complete proxy URL with authentication if configured.
ยงReturns
The proxy URL with embedded authentication credentials if provided
Sourcepub fn to_reqwest_proxy(&self) -> Result<Proxy>
pub fn to_reqwest_proxy(&self) -> Result<Proxy>
Sourcepub fn to_ytdlp_arg(&self) -> String
pub fn to_ytdlp_arg(&self) -> String
Converts to yt-dlp proxy argument format.
ยงReturns
The proxy URL in the format expected by yt-dlpโs --proxy argument.
Includes authentication credentials if configured.
Trait Implementationsยง
Sourceยงimpl Clone for ProxyConfig
impl Clone for ProxyConfig
Sourceยงfn clone(&self) -> ProxyConfig
fn clone(&self) -> ProxyConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSourceยงimpl Debug for ProxyConfig
impl Debug for ProxyConfig
Auto Trait Implementationsยง
impl Freeze for ProxyConfig
impl RefUnwindSafe for ProxyConfig
impl Send for ProxyConfig
impl Sync for ProxyConfig
impl Unpin for ProxyConfig
impl UnsafeUnpin for ProxyConfig
impl UnwindSafe for ProxyConfig
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Sourceยงfn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Sourceยงfn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Sourceยงfn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Anyโs vtable from &Traitโs.Sourceยงfn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Anyโs vtable from &mut Traitโs.