pub enum Proxy {
HTTP(HttpProxy),
Socket(Socket5Proxy),
}Expand description
Configuration of a proxy that a Client should pass requests to.
A Proxy has a couple pieces to it:
- a URL of how to talk to the proxy
- rules on what
Clientrequests should be directed to the proxy
For instance, let’s look at Proxy::http:
let proxy = slinger::Proxy::parse("https://secure.example")?;This proxy will intercept all HTTP requests, and make use of the proxy
at https://secure.example. A request to http://hyper.rs will talk
to your proxy. A request to https://hyper.rs will not.
Multiple Proxy rules can be configured for a Client. The Client will
check each Proxy in the order it was added. This could mean that a
Proxy added first with eager intercept rules, such as Proxy::all,
would prevent a Proxy later in the list from ever working, so take care.
By enabling the "socks" feature it is possible to use a socks proxy:
let proxy = slinger::Proxy::parse("socks5://192.168.1.1:9000")?;Variants§
Implementations§
Trait Implementations§
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 UnwindSafe for Proxy
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)