Struct Connector
pub struct Connector<C, S> { /* private fields */ }
Expand description
Proxy Forward Socks5Connector
implementation,
which actually is able to accept connect requests and process them.
The Default
implementation establishes a connection for the requested
destination Authority
and pipes the incoming Stream
with the established
outgoing Stream
by copying the bytes without doing anyting else with them.
You can customise the Connector
fully by creating it using Connector::new
or overwrite any of the default components using either or both of Connector::with_connector
and Connector::with_service
.
§Lazy Connectors
Please use LazyConnector
in case you do not want the connctor to establish
a connection yet and instead only want to do so once you have the first request,
which can be useful for things such as MITM socks5 proxies for http(s) traffic.
Implementations§
§impl<C, S> Connector<C, S>
impl<C, S> Connector<C, S>
pub fn new(connector: C, service: S) -> Connector<C, S>
pub fn new(connector: C, service: S) -> Connector<C, S>
Create a new Connector
.
In case you only wish to overwrite one of these components
you can also use a Default
Connector
and overwrite the specific component
using Connector::with_connector
or Connector::with_service
.
pub fn set_hide_local_address(&mut self, hide: bool) -> &mut Connector<C, S>
pub fn set_hide_local_address(&mut self, hide: bool) -> &mut Connector<C, S>
Define whether or not the local address is exposed as the bind address in the reply, by default it is exposed.
pub fn with_hide_local_address(self, hide: bool) -> Connector<C, S>
pub fn with_hide_local_address(self, hide: bool) -> Connector<C, S>
Define whether or not the local address is exposed as the bind address in the reply, by default it is exposed.
pub fn set_connect_timeout(
&mut self,
connect_timeout: Duration,
) -> &mut Connector<C, S>
pub fn set_connect_timeout( &mut self, connect_timeout: Duration, ) -> &mut Connector<C, S>
Set field with Some(value)
pub fn with_connect_timeout(self, connect_timeout: Duration) -> Connector<C, S>
pub fn with_connect_timeout(self, connect_timeout: Duration) -> Connector<C, S>
Replace field with Some(value)
pub fn maybe_with_connect_timeout(
self,
connect_timeout: Option<Duration>,
) -> Connector<C, S>
pub fn maybe_with_connect_timeout( self, connect_timeout: Option<Duration>, ) -> Connector<C, S>
Replace field with the provided option
§impl<C, S> Connector<C, S>
impl<C, S> Connector<C, S>
pub fn with_connector<T>(self, connector: T) -> Connector<T, S>
pub fn with_connector<T>(self, connector: T) -> Connector<T, S>
Trait Implementations§
§impl Default for Connector<TcpConnector, StreamForwardService>
impl Default for Connector<TcpConnector, StreamForwardService>
§fn default() -> Connector<TcpConnector, StreamForwardService>
fn default() -> Connector<TcpConnector, StreamForwardService>
Auto Trait Implementations§
impl<C, S> Freeze for Connector<C, S>
impl<C, S> RefUnwindSafe for Connector<C, S>where
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<C, S> Send for Connector<C, S>
impl<C, S> Sync for Connector<C, S>
impl<C, S> Unpin for Connector<C, S>
impl<C, S> UnwindSafe for Connector<C, S>where
C: UnwindSafe,
S: UnwindSafe,
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<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