pub trait RemoteConnection:
Send
+ Sync
+ Debug
+ 'static {
// Required methods
fn clone_boxed(&self) -> Box<dyn RemoteConnection>;
fn open_bi(
&self,
) -> BoxFuture<Result<(SendStream, RecvStream), RequestError>>;
fn zero_rtt_accepted(&self) -> BoxFuture<bool>;
}Available on crate feature
rpc only.Expand description
Trait to abstract over a client connection to a remote service.
This isn’t really that much abstracted, since the result of open_bi must still be a quinn::SendStream and quinn::RecvStream. This is just so we can have different connection implementations for normal quinn connections, iroh connections, and possibly quinn connections with disabled encryption for performance.
This is done as a trait instead of an enum, so we don’t need an iroh dependency in the main crate.
Required Methods§
Sourcefn clone_boxed(&self) -> Box<dyn RemoteConnection>
fn clone_boxed(&self) -> Box<dyn RemoteConnection>
Boxed clone so the trait is dynable.
Sourcefn open_bi(&self) -> BoxFuture<Result<(SendStream, RecvStream), RequestError>>
fn open_bi(&self) -> BoxFuture<Result<(SendStream, RecvStream), RequestError>>
Open a bidirectional stream to the remote service.
Sourcefn zero_rtt_accepted(&self) -> BoxFuture<bool>
fn zero_rtt_accepted(&self) -> BoxFuture<bool>
Returns whether 0-RTT data was accepted by the server.
For connections that were fully authenticated before allowing to send any data, this should return true.