Struct tor_socksproto::handshake::proxy::SocksProxyHandshake
source · pub struct SocksProxyHandshake {
state: State,
socks5_auth: Option<SocksAuth>,
handshake: Option<SocksRequest>,
}
proxy-handshake
only.Expand description
The Proxy (responder) side of an ongoing SOCKS handshake.
To perform a handshake, call the SocksProxyHandshake::handshake
method repeatedly with new inputs, until the resulting Action
has finished
set to true.
Fields§
§state: State
Current state of the handshake. Each completed message advances the state.
socks5_auth: Option<SocksAuth>
SOCKS5 authentication that has been received (but not yet put in a SocksRequest object.)
handshake: Option<SocksRequest>
Completed SOCKS handshake.
Implementations§
source§impl SocksProxyHandshake
impl SocksProxyHandshake
sourcepub fn handshake(&mut self, input: &[u8]) -> TResult<Action>
pub fn handshake(&mut self, input: &[u8]) -> TResult<Action>
Try to advance a SocksProxyHandshake, given some client input in
input
.
If there isn’t enough input, gives a Truncated
.
In this case, the caller must retain the input, and pass it to a later
invocation of handshake
. Input should only be regarded as consumed when
the Action::drain
field is nonzero.
Other errors (besides Truncated
) indicate a failure.
On success, return an Action describing what to tell the client, and how much of its input to consume.
sourcefn s5_initial(&mut self, input: &[u8]) -> Result<Action>
fn s5_initial(&mut self, input: &[u8]) -> Result<Action>
Socks5: initial handshake to negotiate authentication method.
sourcefn s5_uname(&mut self, input: &[u8]) -> Result<Action>
fn s5_uname(&mut self, input: &[u8]) -> Result<Action>
Socks5: second step for username/password authentication.
sourcefn s5(&mut self, input: &[u8]) -> Result<Action>
fn s5(&mut self, input: &[u8]) -> Result<Action>
Socks5: final step, to receive client’s request.
sourcepub fn into_request(self) -> Option<SocksRequest>
pub fn into_request(self) -> Option<SocksRequest>
Consume this handshake’s state; if it finished successfully, return a SocksRequest.
Trait Implementations§
source§impl Clone for SocksProxyHandshake
impl Clone for SocksProxyHandshake
source§fn clone(&self) -> SocksProxyHandshake
fn clone(&self) -> SocksProxyHandshake
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SocksProxyHandshake
impl Debug for SocksProxyHandshake
Auto Trait Implementations§
impl Freeze for SocksProxyHandshake
impl RefUnwindSafe for SocksProxyHandshake
impl Send for SocksProxyHandshake
impl Sync for SocksProxyHandshake
impl Unpin for SocksProxyHandshake
impl UnwindSafe for SocksProxyHandshake
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
§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