pub struct ProxyConfig {
pub url: String,
pub host: String,
pub port: u16,
pub username: Option<String>,
pub password: Option<SecretString>,
/* private fields */
}Expand description
Parsed HTTP CONNECT proxy configuration.
Credentials are stored in a SecretString so they never appear in
Debug output or error diagnostics. The url field is kept for
diagnostics but is the raw string supplied by the caller.
Fields§
§url: StringThe original URL string (for diagnostics only — may contain credentials that should not be logged).
host: StringProxy hostname or IP.
port: u16Proxy port.
username: Option<String>Username for Basic auth (optional).
password: Option<SecretString>Password for Basic auth (optional).
Implementations§
Source§impl ProxyConfig
impl ProxyConfig
Sourcepub fn parse(url: &str) -> Result<Self, Error>
pub fn parse(url: &str) -> Result<Self, Error>
Parse from a URL string like http://proxy:8080 or
http://user:pass@proxy:3128.
§Errors
Returns Error::InvalidUrl when the string is not a valid URL,
has no host, or uses a non-HTTP scheme.
Sourcepub fn url_without_credentials(&self) -> String
pub fn url_without_credentials(&self) -> String
Return the proxy URL with credentials removed, suitable for
passing to HTTP client libraries (e.g. reqwest::Proxy::all).
If the original URL contained a password, this returns
http://proxy:8080 so the library handles auth itself via the
username/password fields.
Trait Implementations§
Source§impl Clone for ProxyConfig
impl Clone for ProxyConfig
Source§fn clone(&self) -> ProxyConfig
fn clone(&self) -> ProxyConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more