Skip to main content

relay_connection

Function relay_connection 

Source
pub async fn relay_connection<S>(
    local: S,
    endpoint: &str,
    guest_port: u16,
    agent_token: &str,
    auth: &Arc<ProxyAuth>,
) -> Result<TunnelEnd, Error>
where S: AsyncRead + AsyncWrite + Unpin,
Expand description

Opens a tunnel to guest_port and relays local over it until either side closes.

local is any duplex stream, so a test drives this with an in-memory pipe and the CLI drives it with a TcpStream. Returns how the tunnel ended, which is a value rather than an error for TunnelEnd::Closed: a finished tunnel is a success, and a caller that treated it as a failure would retry a completed request.