Struct SocksV5
pub struct SocksV5<C> { /* private fields */ }
Tunnel Proxy via SOCKSv5
This is a connector that can be used by the legacy::Client. It wraps
another connector, and after getting an underlying connection, it establishes
a TCP tunnel over it using SOCKSv5.
Implementations
impl<C> SocksV5<C>
fn new(proxy_dst: Uri, connector: C) -> SelfCreate a new SOCKSv5 handshake service.
Wraps an underlying connector and stores the address of a tunneling proxying server.
A
SocksV5can then be called with any destination. Thedstpassed tocallwill not be used to create the underlying connection, but will be used in a SOCKS handshake with the proxy destination.fn with_auth(self, user: String, pass: String) -> SelfUse User/Pass authentication method during handshake.
Username and Password must be maximum of 255 characters each. 0 length strings are allowed despite RFC prohibiting it. This is done for compatablity with server implementations that use empty credentials to allow returning error codes during IP authentication.
fn local_dns(self, local_dns: bool) -> SelfResolve domain names locally on the client, rather than on the proxy server.
Disabled by default as local resolution of domain names can be detected as a DNS leak.
fn send_optimistically(self, optimistic: bool) -> SelfSend all messages of the handshake optmistically (without waiting for server response).
A typical SOCKS handshake with user/pass authentication takes 3 round trips Optimistic sending can reduce round trip times and dramatically increase speed of handshake at the cost of reduced portability; many server implementations do not support optimistic sending as it is not defined in the RFC.
Recommended to ensure connector works correctly without optimistic sending before trying with optimistic sending.
Trait Implementations
impl<C> Service<Uri> for SocksV5<C>
where
C: Service<Uri>,
C::Future: Send + 'static,
C::Response: Read + Write + Unpin + Send + 'static,
C::Error: Send + 'static,
type Response = <C as Service<Uri>>::Response;type Error = SocksError<<C as Service<Uri>>::Error>;type Future = Handshaking<<C as Service<Uri>>::Future, <C as Service<Uri>>::Response, <C as Service<Uri>>::Error>;fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>fn call(&mut self, dst: Uri) -> Self::Future
impl<C: Clone> Clone for SocksV5<C>
fn clone(&self) -> SocksV5<C>
impl<C: Debug> Debug for SocksV5<C>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<C> !Freeze for SocksV5<C>
impl<C> RefUnwindSafe for SocksV5<C>
where
C: RefUnwindSafe,
impl<C> Send for SocksV5<C>
where
C: Send,
impl<C> Sync for SocksV5<C>
where
C: Sync,
impl<C> Unpin for SocksV5<C>
where
C: Unpin,
impl<C> UnsafeUnpin for SocksV5<C>
where
C: UnsafeUnpin,
impl<C> UnwindSafe for SocksV5<C>
where
C: UnwindSafe,
Blanket Implementations
impl<S, T> Connect for SocksV5<C>
where
S: Service<Uri, Response = T> + Send + 'static,
<S as Service<Uri>>::Error: Into<Box<dyn Error + Sync + Send>>,
<S as Service<Uri>>::Future: Unpin + Send,
T: Read + Write + Connection + Unpin + Send + 'static,
type _Svc = S;fn connect(self, Internal, dst: Uri) -> Oneshot<S, Uri>
impl<T> Any for SocksV5<C>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for SocksV5<C>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for SocksV5<C>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for SocksV5<C>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for SocksV5<C>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for SocksV5<C>
impl<T> ToOwned for SocksV5<C>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> WithSubscriber for SocksV5<C>
impl<T, U> Into<U> for SocksV5<C>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for SocksV5<C>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for SocksV5<C>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>