pub struct SocksV5<C> { /* private fields */ }
client
and client-legacy
only.Expand description
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 established
a TCP tunnel over it using SOCKSv5.
Implementations§
Source§impl<C> SocksV5<C>
impl<C> SocksV5<C>
Sourcepub fn new(proxy_dst: Uri, connector: C) -> Self
pub fn new(proxy_dst: Uri, connector: C) -> Self
Create a new SOCKSv5 handshake service.
Wraps an underlying connector and stores the address of a tunneling proxying server.
A SocksV5
can then be called with any destination. The dst
passed to
call
will not be used to create the underlying connection, but will
be used in a SOCKS handshake with the proxy destination.
Sourcepub fn with_auth(self, user: String, pass: String) -> Self
pub fn with_auth(self, user: String, pass: String) -> Self
Use 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 so that for compatablity with server implementations that require it for IP authentication.
Sourcepub fn local_dns(self, local_dns: bool) -> Self
pub fn local_dns(self, local_dns: bool) -> Self
Resolve 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.
Sourcepub fn send_optimistically(self, optimistic: bool) -> Self
pub fn send_optimistically(self, optimistic: bool) -> Self
Send all messages of the handshake optmistically (without waiting for server response).
Typical SOCKS handshake with auithentication 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 (RFC 1928).
Recommended to ensure connector works correctly without optimistic sending before trying with optimistic sending.