#[non_exhaustive]pub struct Proxy<U, C>{
pub upstreams: U,
pub client: C,
pub url_path_getter: UrlPartGetter,
pub url_query_getter: UrlPartGetter,
}
Expand description
Handler that can proxy request to other server.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.upstreams: U
Upstreams list.
client: C
Client
for proxy.
url_path_getter: UrlPartGetter
Url path getter.
url_query_getter: UrlPartGetter
Url query getter.
Implementations§
Source§impl<U> Proxy<U, HyperClient>
impl<U> Proxy<U, HyperClient>
Sourcepub fn use_hyper_client(upstreams: U) -> Self
Available on crate feature hyper-client
only.
pub fn use_hyper_client(upstreams: U) -> Self
hyper-client
only.Create a new Proxy
using the default Hyper client.
This is a convenient way to create a proxy with standard configuration.
Source§impl<U> Proxy<U, ReqwestClient>
impl<U> Proxy<U, ReqwestClient>
Sourcepub fn use_reqwest_client(upstreams: U) -> Self
Available on crate feature reqwest-client
only.
pub fn use_reqwest_client(upstreams: U) -> Self
reqwest-client
only.Create a new Proxy
using the default Reqwest client.
This is a convenient way to create a proxy with standard configuration.
Source§impl<U> Proxy<U, UnixSockClient>
impl<U> Proxy<U, UnixSockClient>
Sourcepub fn use_unix_sock_tunnel(upstreams: U) -> Self
Available on crate feature unix-sock-client
only.
pub fn use_unix_sock_tunnel(upstreams: U) -> Self
unix-sock-client
only.Create a new Proxy
that tunnels connections to a Unix socket.
Source§impl<U, C> Proxy<U, C>
impl<U, C> Proxy<U, C>
Sourcepub fn url_path_getter<G>(self, url_path_getter: G) -> Self
pub fn url_path_getter<G>(self, url_path_getter: G) -> Self
Set url path getter.
Sourcepub fn url_query_getter<G>(self, url_query_getter: G) -> Self
pub fn url_query_getter<G>(self, url_query_getter: G) -> Self
Set url query getter.
Sourcepub fn upstreams_mut(&mut self) -> &mut U
pub fn upstreams_mut(&mut self) -> &mut U
Get upstreams mutable list.
Sourcepub fn client_mut(&mut self) -> &mut C
pub fn client_mut(&mut self) -> &mut C
Get client mutable reference.
Trait Implementations§
Source§impl<U, C> Handler for Proxy<U, C>
impl<U, C> Handler for Proxy<U, C>
Source§fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
_ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
_ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Handle http request.
Source§fn arc(self) -> ArcHandlerwhere
Self: Sized,
fn arc(self) -> ArcHandlerwhere
Self: Sized,
Wrap to
ArcHandler
.Source§fn hoop<H>(self, hoop: H) -> HoopedHandler
fn hoop<H>(self, hoop: H) -> HoopedHandler
Hoop this handler with middleware.
Auto Trait Implementations§
impl<U, C> Freeze for Proxy<U, C>
impl<U, C> !RefUnwindSafe for Proxy<U, C>
impl<U, C> Send for Proxy<U, C>
impl<U, C> Sync for Proxy<U, C>
impl<U, C> Unpin for Proxy<U, C>
impl<U, C> !UnwindSafe for Proxy<U, C>
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