Skip to main content

connect_via_proxy

Function connect_via_proxy 

Source
pub(crate) async fn connect_via_proxy<R: NetStreamProvider + Send + Sync>(
    runtime: &R,
    proxy: &SocketAddr,
    protocol: &Protocol,
    target: &PtTargetAddr,
) -> Result<R::Stream, ProxyError>
Expand description

Open a connection to target via the proxy at proxy, using the protocol at protocol.

§Limitations

We will give an error if the proxy sends us any data on the connection along with its final handshake: due to our implementation, any such data will be discarded, and so we give an error rather than fail silently.

This limitation doesn’t matter when the underlying protocol is Tor, or anything else where the initiator is expected to speak before the responder says anything. To lift it, we would have to make this function’s return type become something buffered.