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: SocksVersionNegotiated SOCKS protocol version.
cmd: SocksCmdThe command requested by the SOCKS client.
addr: SocksAddrThe target address.
port: u16The target port.
auth: SocksAuthAuthentication 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>>
pub fn reply( &self, status: SocksStatus, addr: Option<&SocksAddr>, ) -> EncodeResult<Vec<u8>>
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.
Sourcefn s4(
&self,
status: SocksStatus,
addr: Option<&SocksAddr>,
) -> EncodeResult<Vec<u8>>
fn s4( &self, status: SocksStatus, addr: Option<&SocksAddr>, ) -> EncodeResult<Vec<u8>>
Format a SOCKS4 reply.
Sourcefn s5(
&self,
status: SocksStatus,
addr: Option<&SocksAddr>,
) -> EncodeResult<Vec<u8>>
fn s5( &self, status: SocksStatus, addr: Option<&SocksAddr>, ) -> EncodeResult<Vec<u8>>
Format a SOCKS5 reply.
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
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> ArbitraryResult<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> ArbitraryResult<Self>
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>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for SocksRequest
impl Clone for SocksRequest
Source§fn clone(&self) -> SocksRequest
fn clone(&self) -> SocksRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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 UnsafeUnpin for SocksRequest
impl UnwindSafe for SocksRequest
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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,
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>
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