Struct Socks5Acceptor
pub struct Socks5Acceptor<C = Connector<TcpConnector, StreamForwardService>, B = (), U = (), A = ()> { /* private fields */ }
Expand description
Socks5 server implementation of RFC 1928
An instance constructed with Socks5Acceptor::new
is one that accepts none of the available Command
s,
until you embed one or more of: connector, binder and udp associator.
§Default
The Default
implementation of the Socks5Acceptor
only
supports the Command::Connect
method using the DefaultConnector
,
but custom connectors as well as binders and udp associators
are optionally possible.
Implementations§
§impl Socks5Acceptor<()>
impl Socks5Acceptor<()>
pub fn new() -> Socks5Acceptor<()>
pub fn new() -> Socks5Acceptor<()>
Create a new Socks5Acceptor
which supports none of the valid Command
s.
Use Socks5Acceptor::default
instead if you wish to create a default
Socks5Acceptor
which can be used as a simple and honest byte-byte proxy.
§impl<C, B, U> Socks5Acceptor<C, B, U>
impl<C, B, U> Socks5Acceptor<C, B, U>
pub fn with_auth_optional(self, optional: bool) -> Socks5Acceptor<C, B, U>
pub fn with_auth_optional(self, optional: bool) -> Socks5Acceptor<C, B, U>
Define whether or not the authentication (if supported by this Socks5Acceptor
) is optional,
by default it is no optional.
Making authentication optional, despite supporting authentication on server side, can be useful in case you wish to support so called Guest users.
pub fn set_auth_optional(
&mut self,
optional: bool,
) -> &mut Socks5Acceptor<C, B, U>
pub fn set_auth_optional( &mut self, optional: bool, ) -> &mut Socks5Acceptor<C, B, U>
Define whether or not the authentication (if supported by this Socks5Acceptor
) is optional,
by default it is no optional.
Making authentication optional, despite supporting authentication on server side, can be useful in case you wish to support so called Guest users.
§impl<B, U, A> Socks5Acceptor<(), B, U, A>
impl<B, U, A> Socks5Acceptor<(), B, U, A>
pub fn with_connector<C>(self, connector: C) -> Socks5Acceptor<C, B, U, A>
pub fn with_connector<C>(self, connector: C) -> Socks5Acceptor<C, B, U, A>
Attach a Socks5Connector
to this Socks5Acceptor
,
used to accept incoming Command::Connect
client::Request
s.
Use Socks5Acceptor::with_default_connector
in case
the DefaultConnector
serves your needs just fine.
pub fn with_default_connector(
self,
) -> Socks5Acceptor<Connector<TcpConnector, StreamForwardService>, B, U, A>
pub fn with_default_connector( self, ) -> Socks5Acceptor<Connector<TcpConnector, StreamForwardService>, B, U, A>
Attach the DefaultConnector
to this Socks5Acceptor
,
used to accept incoming Command::Connect
client::Request
s.
Use Socks5Acceptor::with_connector
in case you want to use a custom
Socks5Connector
or customised Connector
.
§impl<C, U, A> Socks5Acceptor<C, (), U, A>
impl<C, U, A> Socks5Acceptor<C, (), U, A>
pub fn with_binder<B>(self, binder: B) -> Socks5Acceptor<C, B, U, A>
pub fn with_binder<B>(self, binder: B) -> Socks5Acceptor<C, B, U, A>
Attach a Socks5Binder
to this Socks5Acceptor
,
used to accept incoming Command::Bind
client::Request
s.
Use Socks5Acceptor::with_default_binder
in case
the DefaultConnector
serves your needs just fine.
pub fn with_default_binder(
self,
) -> Socks5Acceptor<C, Binder<Timeout<DefaultAcceptorFactory, LayerErrorStatic<Elapsed>>, StreamForwardService>, U, A>
pub fn with_default_binder( self, ) -> Socks5Acceptor<C, Binder<Timeout<DefaultAcceptorFactory, LayerErrorStatic<Elapsed>>, StreamForwardService>, U, A>
Attach the DefaultBinder
to this Socks5Acceptor
,
used to accept incoming Command::Bind
client::Request
s.
Use Socks5Acceptor::with_binder
in case you want to use a custom
Socks5Binder
or customised Binder
.
§impl<C, B, A> Socks5Acceptor<C, B, (), A>
impl<C, B, A> Socks5Acceptor<C, B, (), A>
pub fn with_udp_associator<U>(
self,
udp_associator: U,
) -> Socks5Acceptor<C, B, U, A>
pub fn with_udp_associator<U>( self, udp_associator: U, ) -> Socks5Acceptor<C, B, U, A>
Attach a Socks5UdpAssociator
to this Socks5Acceptor
,
used to accept incoming Command::UdpAssociate
client::Request
s.
Use Socks5Acceptor::with_default_udp_associator
in case
the DefaultUdpRelay
serves your needs just fine.
pub fn with_default_udp_associator(
self,
) -> Socks5Acceptor<C, B, UdpRelay<Timeout<DefaultUdpBinder, LayerErrorStatic<Elapsed>>, DirectUdpRelay>, A>
pub fn with_default_udp_associator( self, ) -> Socks5Acceptor<C, B, UdpRelay<Timeout<DefaultUdpBinder, LayerErrorStatic<Elapsed>>, DirectUdpRelay>, A>
Attach the DefaultUdpRelay
to this Socks5Acceptor
,
used to accept incoming Command::UdpAssociate
client::Request
s.
Use Socks5Acceptor::with_udp_associator
in case you want to use a custom
Socks5UdpAssociator
or customised udp::UdpRelay
.
§impl<C, B, U, A> Socks5Acceptor<C, B, U, A>
impl<C, B, U, A> Socks5Acceptor<C, B, U, A>
pub async fn accept<S>(&self, ctx: Context, stream: S) -> Result<(), Error>where
C: Socks5Connector<S>,
U: Socks5UdpAssociator<S>,
A: Authorizer<Basic>,
<A as Authorizer<Basic>>::Error: Debug,
B: Socks5Binder<S>,
S: Stream + Unpin,
§impl<C, B, U, A> Socks5Acceptor<C, B, U, A>where
C: Socks5Connector<TcpStream>,
U: Socks5UdpAssociator<TcpStream>,
A: Authorizer<Basic>,
<A as Authorizer<Basic>>::Error: Debug,
B: Socks5Binder<TcpStream>,
impl<C, B, U, A> Socks5Acceptor<C, B, U, A>where
C: Socks5Connector<TcpStream>,
U: Socks5UdpAssociator<TcpStream>,
A: Authorizer<Basic>,
<A as Authorizer<Basic>>::Error: Debug,
B: Socks5Binder<TcpStream>,
Trait Implementations§
§impl<C, B, U, A> Clone for Socks5Acceptor<C, B, U, A>
impl<C, B, U, A> Clone for Socks5Acceptor<C, B, U, A>
§fn clone(&self) -> Socks5Acceptor<C, B, U, A>
fn clone(&self) -> Socks5Acceptor<C, B, U, A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<C, B, U, A> Debug for Socks5Acceptor<C, B, U, A>
impl<C, B, U, A> Debug for Socks5Acceptor<C, B, U, A>
§impl Default for Socks5Acceptor
impl Default for Socks5Acceptor
§fn default() -> Socks5Acceptor
fn default() -> Socks5Acceptor
§impl<C, B, U, A, S> Service<S> for Socks5Acceptor<C, B, U, A>where
C: Socks5Connector<S>,
U: Socks5UdpAssociator<S>,
A: Authorizer<Basic>,
<A as Authorizer<Basic>>::Error: Debug,
B: Socks5Binder<S>,
S: Stream + Unpin,
impl<C, B, U, A, S> Service<S> for Socks5Acceptor<C, B, U, A>where
C: Socks5Connector<S>,
U: Socks5UdpAssociator<S>,
A: Authorizer<Basic>,
<A as Authorizer<Basic>>::Error: Debug,
B: Socks5Binder<S>,
S: Stream + Unpin,
§fn serve(
&self,
ctx: Context,
stream: S,
) -> impl Future<Output = Result<<Socks5Acceptor<C, B, U, A> as Service<S>>::Response, <Socks5Acceptor<C, B, U, A> as Service<S>>::Error>> + Send
fn serve( &self, ctx: Context, stream: S, ) -> impl Future<Output = Result<<Socks5Acceptor<C, B, U, A> as Service<S>>::Response, <Socks5Acceptor<C, B, U, A> as Service<S>>::Error>> + Send
§fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
Auto Trait Implementations§
impl<C, B, U, A> Freeze for Socks5Acceptor<C, B, U, A>
impl<C, B, U, A> RefUnwindSafe for Socks5Acceptor<C, B, U, A>
impl<C, B, U, A> Send for Socks5Acceptor<C, B, U, A>
impl<C, B, U, A> Sync for Socks5Acceptor<C, B, U, A>
impl<C, B, U, A> Unpin for Socks5Acceptor<C, B, U, A>
impl<C, B, U, A> UnwindSafe for Socks5Acceptor<C, B, U, A>
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