pub struct ProxyConfig {
pub proxy_type: ProxyType,
pub host: String,
pub port: u16,
pub username: Option<String>,
pub password: Option<String>,
pub proxy_dns: bool,
}Expand description
Proxy configuration.
§Example
use firefox_webdriver::ProxyConfig;
// HTTP proxy without auth
let proxy = ProxyConfig::http("proxy.example.com", 8080);
// SOCKS5 proxy with auth
let proxy = ProxyConfig::socks5("proxy.example.com", 1080)
.with_credentials("user", "pass")
.with_proxy_dns(true);Fields§
§proxy_type: ProxyTypeProxy type.
host: StringProxy hostname.
port: u16Proxy port.
username: Option<String>Username for authentication (optional).
password: Option<String>Password for authentication (optional).
proxy_dns: boolWhether to proxy DNS queries (SOCKS4/SOCKS5 only).
Implementations§
Source§impl ProxyConfig
impl ProxyConfig
Sourcepub fn new(proxy_type: ProxyType, host: impl Into<String>, port: u16) -> Self
pub fn new(proxy_type: ProxyType, host: impl Into<String>, port: u16) -> Self
Creates a new proxy configuration.
§Arguments
proxy_type- Proxy protocol typehost- Proxy hostnameport- Proxy port
Sourcepub fn socks4(host: impl Into<String>, port: u16) -> Self
pub fn socks4(host: impl Into<String>, port: u16) -> Self
Creates a SOCKS4 proxy configuration.
Source§impl ProxyConfig
impl ProxyConfig
Sourcepub fn with_credentials(
self,
username: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn with_credentials( self, username: impl Into<String>, password: impl Into<String>, ) -> Self
Sourcepub fn with_proxy_dns(self, proxy_dns: bool) -> Self
pub fn with_proxy_dns(self, proxy_dns: bool) -> Self
Enables DNS proxying (SOCKS4/SOCKS5 only).
When enabled, DNS queries are sent through the proxy.
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 · 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
Source§impl<'de> Deserialize<'de> for ProxyConfig
impl<'de> Deserialize<'de> for ProxyConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ProxyConfig
impl RefUnwindSafe for ProxyConfig
impl Send for ProxyConfig
impl Sync for ProxyConfig
impl Unpin 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