using DodoSSH.Client.Ssh;
namespace DodoSSH.Client.Session;
///
/// A way to a host that is not a dial: one connection long, handed to SSH.NET as a loopback proxy.
///
///
///
/// Two things answer to this — the server relay () and a Spelunk tunnel
/// () — and both are the same shape underneath: a WebSocket carrying the
/// SSH bytes, and a that turns it into an address SSH.NET can be given. What the
/// connect path needs from either is exactly that address, the reason the far end gave if it hung up, and a
/// way to let go of it when the connect never got as far as handing it over.
///
///
/// Handing to a connection hands the bridge over with it, so the connection's own
/// disposal is what closes the route. is for a caller that ends
/// up not connecting; after a hand-over it does nothing, because the bridge's disposal is idempotent.
///
///
public interface IConnectionRoute : IAsyncDisposable
{
/// The loopback proxy to connect through, which owns the route from then on.
SshLoopbackProxy Proxy { get; }
///
/// What the far end said when it closed, in words a user can act on; null when it has not closed, or
/// closed with nothing to say.
///
///
/// For a connect that failed. SSH.NET reports a route that hung up as a stream that ended, which reads
/// exactly like the direct connection the route was chosen to get around — so the route's own reason,
/// when it gave one, replaces it.
///
string? Failure { get; }
}