Struct Socks5ProxyConnector
pub struct Socks5ProxyConnector<S> { /* private fields */ }
Expand description
A connector which can be used to establish a connection over a SOCKS5 Proxy.
This behaviour is optional and only triggered in case there
is a ProxyAddress
found in the Context
.
Implementations§
§impl<S> Socks5ProxyConnector<S>
impl<S> Socks5ProxyConnector<S>
pub fn optional(inner: S) -> Socks5ProxyConnector<S>
pub fn optional(inner: S) -> Socks5ProxyConnector<S>
Creates a new optional Socks5ProxyConnector
.
pub fn required(inner: S) -> Socks5ProxyConnector<S>
pub fn required(inner: S) -> Socks5ProxyConnector<S>
Creates a new required Socks5ProxyConnector
.
pub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self
, returning the underlying service.
§impl<S> Socks5ProxyConnector<S>
impl<S> Socks5ProxyConnector<S>
pub fn with_default_dns_resolver(self) -> Socks5ProxyConnector<S>
pub fn with_default_dns_resolver(self) -> Socks5ProxyConnector<S>
Attach the Default
DnsResolver
to this Socks5ProxyConnector
.
It will try to be used (best-effort) to resolve domain addresses
as IP addresses if the socks5
protocol is used, but not for the socks5h
protocol.
In case of an error with resolving the domain address the connector will anyway use the domain instead of the ip.
pub fn set_default_dns_resolver(&mut self) -> &mut Socks5ProxyConnector<S>
pub fn set_default_dns_resolver(&mut self) -> &mut Socks5ProxyConnector<S>
Attach the Default
DnsResolver
to this Socks5ProxyConnector
.
It will try to be used (best-effort) to resolve domain addresses
as IP addresses if the socks5
protocol is used, but not for the socks5h
protocol.
In case of an error with resolving the domain address the connector will anyway use the domain instead of the ip.
pub fn with_dns_resolver(
self,
resolver: impl DnsResolver,
) -> Socks5ProxyConnector<S>
pub fn with_dns_resolver( self, resolver: impl DnsResolver, ) -> Socks5ProxyConnector<S>
Attach a DnsResolver
to this Socks5ProxyConnector
.
It will try to be used (best-effort) to resolve domain addresses
as IP addresses if the socks5
protocol is used, but not for the socks5h
protocol.
In case of an error with resolving the domain address the connector will anyway use the domain instead of the ip.
pub fn set_dns_resolver(
&mut self,
resolver: impl DnsResolver,
) -> &mut Socks5ProxyConnector<S>
pub fn set_dns_resolver( &mut self, resolver: impl DnsResolver, ) -> &mut Socks5ProxyConnector<S>
Attach a DnsResolver
to this Socks5ProxyConnector
.
It will try to be used (best-effort) to resolve domain addresses
as IP addresses if the socks5
protocol is used, but not for the socks5h
protocol.
In case of an error with resolving the domain address the connector will anyway use the domain instead of the ip.
Trait Implementations§
§impl<S> Clone for Socks5ProxyConnector<S>where
S: Clone,
impl<S> Clone for Socks5ProxyConnector<S>where
S: Clone,
§fn clone(&self) -> Socks5ProxyConnector<S>
fn clone(&self) -> Socks5ProxyConnector<S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<S> Debug for Socks5ProxyConnector<S>where
S: Debug,
impl<S> Debug for Socks5ProxyConnector<S>where
S: Debug,
§impl<S, Request> Service<Request> for Socks5ProxyConnector<S>where
S: ConnectorService<Request>,
<S as ConnectorService<Request>>::Connection: Stream + Unpin,
<S as ConnectorService<Request>>::Error: Into<Box<dyn Error + Sync + Send>>,
Request: TryRefIntoTransportContext + Send + 'static,
<Request as TryRefIntoTransportContext>::Error: Into<Box<dyn Error + Sync + Send>> + Send + 'static,
impl<S, Request> Service<Request> for Socks5ProxyConnector<S>where
S: ConnectorService<Request>,
<S as ConnectorService<Request>>::Connection: Stream + Unpin,
<S as ConnectorService<Request>>::Error: Into<Box<dyn Error + Sync + Send>>,
Request: TryRefIntoTransportContext + Send + 'static,
<Request as TryRefIntoTransportContext>::Error: Into<Box<dyn Error + Sync + Send>> + Send + 'static,
§type Response = EstablishedClientConnection<<S as ConnectorService<Request>>::Connection, Request>
type Response = EstablishedClientConnection<<S as ConnectorService<Request>>::Connection, Request>
§async fn serve(
&self,
ctx: Context,
req: Request,
) -> Result<<Socks5ProxyConnector<S> as Service<Request>>::Response, <Socks5ProxyConnector<S> as Service<Request>>::Error>
async fn serve( &self, ctx: Context, req: Request, ) -> Result<<Socks5ProxyConnector<S> as Service<Request>>::Response, <Socks5ProxyConnector<S> as Service<Request>>::Error>
§fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
Auto Trait Implementations§
impl<S> Freeze for Socks5ProxyConnector<S>where
S: Freeze,
impl<S> !RefUnwindSafe for Socks5ProxyConnector<S>
impl<S> Send for Socks5ProxyConnector<S>where
S: Send,
impl<S> Sync for Socks5ProxyConnector<S>where
S: Sync,
impl<S> Unpin for Socks5ProxyConnector<S>where
S: Unpin,
impl<S> !UnwindSafe for Socks5ProxyConnector<S>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S, Request, Connection> ConnectorService<Request> for S
impl<S, Request, Connection> ConnectorService<Request> for S
§type Connection = Connection
type Connection = Connection
ConnectorService
§fn connect(
&self,
ctx: Context,
req: Request,
) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<Request>>::Connection, Request>, <S as ConnectorService<Request>>::Error>> + Send
fn connect( &self, ctx: Context, req: Request, ) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<Request>>::Connection, Request>, <S as ConnectorService<Request>>::Error>> + Send
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more