pub struct SocksRequest {
version: SocksVersion,
cmd: SocksCmd,
addr: SocksAddr,
port: u16,
auth: SocksAuth,
}
Expand description
A completed SOCKS request, as negotiated on a SOCKS connection.
Once this request is done, we know where to connect. Don’t discard this object immediately: Use it to report success or failure.
Fields§
§version: SocksVersion
Negotiated SOCKS protocol version.
cmd: SocksCmd
The command requested by the SOCKS client.
addr: SocksAddr
The target address.
port: u16
The target port.
auth: SocksAuth
Authentication information.
(Tor doesn’t believe in SOCKS authentication, since it cannot possibly secure. Instead, we use it for circuit isolation.)
Implementations§
Source§impl SocksRequest
impl SocksRequest
Sourcepub fn reply(
&self,
status: SocksStatus,
addr: Option<&SocksAddr>,
) -> EncodeResult<Vec<u8>>
Available on crate feature proxy-handshake
only.
pub fn reply( &self, status: SocksStatus, addr: Option<&SocksAddr>, ) -> EncodeResult<Vec<u8>>
proxy-handshake
only.Format a reply to this request, indicating success or failure.
Note that an address should be provided only when the request was for a RESOLVE.
Source§impl SocksRequest
impl SocksRequest
Sourcepub fn new(
version: SocksVersion,
cmd: SocksCmd,
addr: SocksAddr,
port: u16,
auth: SocksAuth,
) -> Result<Self>
pub fn new( version: SocksVersion, cmd: SocksCmd, addr: SocksAddr, port: u16, auth: SocksAuth, ) -> Result<Self>
Create a SocksRequest with a given set of fields.
Return an error if the inputs aren’t supported or valid.
Sourcepub fn version(&self) -> SocksVersion
pub fn version(&self) -> SocksVersion
Return the negotiated version (4 or 5).
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for SocksRequest
Available on crate feature arbitrary
only.
impl<'a> Arbitrary<'a> for SocksRequest
Available on crate feature
arbitrary
only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> ArbitraryResult<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> ArbitraryResult<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moreSource§impl Clone for SocksRequest
impl Clone for SocksRequest
Source§fn clone(&self) -> SocksRequest
fn clone(&self) -> SocksRequest
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for SocksRequest
impl RefUnwindSafe for SocksRequest
impl Send for SocksRequest
impl Sync for SocksRequest
impl Unpin for SocksRequest
impl UnwindSafe for SocksRequest
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Converts
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>
Converts
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