Struct tor_socksproto::SocksRequest
source · pub struct SocksRequest { /* private fields */ }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.
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 moresource§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§
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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