Skip to main content

Proxy

Struct Proxy 

Source
pub struct Proxy {
    pub proxy_type: ProxyType,
    pub host: String,
    pub port: u16,
    pub username: Option<String>,
    pub password: Option<String>,
}
Expand description

Proxy configuration for an outgoing HTTP / WebSocket request.

Proxy is a value type with no Arc<RwLock> wrapping — exactly like hyperlane-core’s plain fields. Construct one with the convenience constructors below, then pass to RequestBuilder::proxy(...) or assign directly to RequestConfig::proxy.

§Examples

ⓘ
use http_request::Proxy;

let p = Proxy::https("proxy.example.com", 7890);
let auth = Proxy::socks5("127.0.0.1", 1080).auth("user", "pass");

Fields§

§proxy_type: ProxyType

Proxy protocol family.

§host: String

Proxy server hostname or IP.

§port: u16

Proxy server port.

§username: Option<String>

Optional username for proxy auth.

§password: Option<String>

Optional password for proxy auth.

Implementations§

Source§

impl Proxy

Source

pub fn get_proxy_type(&self) -> &ProxyType

Source

pub fn get_mut_proxy_type(&mut self) -> &mut ProxyType

Source

pub fn set_proxy_type(&mut self, val: ProxyType) -> &mut Self

Source

pub fn get_host(&self) -> &String

Source

pub fn get_mut_host(&mut self) -> &mut String

Source

pub fn set_host(&mut self, val: String) -> &mut Self

Source

pub fn get_port(&self) -> &u16

Source

pub fn get_mut_port(&mut self) -> &mut u16

Source

pub fn set_port(&mut self, val: u16) -> &mut Self

Source

pub fn get_username(&self) -> String

Source

pub fn try_get_username(&self) -> &Option<String>

Source

pub fn get_mut_username(&mut self) -> &mut Option<String>

Source

pub fn set_username(&mut self, val: Option<String>) -> &mut Self

Source

pub fn get_password(&self) -> String

Source

pub fn try_get_password(&self) -> &Option<String>

Source

pub fn get_mut_password(&mut self) -> &mut Option<String>

Source

pub fn set_password(&mut self, val: Option<String>) -> &mut Self

Source§

impl Proxy

Source

pub fn http<H: AsRef<str>>(host: H, port: u16) -> Self

Plain HTTP proxy.

Source

pub fn https<H: AsRef<str>>(host: H, port: u16) -> Self

HTTPS proxy (TLS-wrapped).

Source

pub fn socks5<H: AsRef<str>>(host: H, port: u16) -> Self

SOCKS5 proxy.

Source

pub fn auth<U: AsRef<str>, P: AsRef<str>>( self, username: U, password: P, ) -> Self

Attach username / password to this proxy.

Trait Implementations§

Source§

impl Clone for Proxy

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Proxy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Proxy

Source§

impl PartialEq for Proxy

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Proxy

Auto Trait Implementations§

§

impl Freeze for Proxy

§

impl RefUnwindSafe for Proxy

§

impl Send for Proxy

§

impl Sync for Proxy

§

impl Unpin for Proxy

§

impl UnsafeUnpin for Proxy

§

impl UnwindSafe for Proxy

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnySend for T
where T: Any + Send,

Source§

impl<T> AnySendClone for T
where T: Any + Send + Clone,

Source§

impl<T> AnySendSync for T
where T: Any + Send + Sync,

Source§

impl<T> AnySendSyncClone for T
where T: Any + Send + Sync + Clone,

Source§

impl<T> AnySync for T
where T: Any + Sync,

Source§

impl<T> AnySyncClone for T
where T: Any + Sync + Clone,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.