pub struct PeerChannel { /* private fields */ }Expand description
An established, verified peering channel: the TLS 1.3 stream the handshake completed, bound to the peer whose hybrid identity it verified. Every frame after the handshake travels inside this TLS session and nowhere else.
Implementations§
Source§impl PeerChannel
impl PeerChannel
Sourcepub async fn receive_offer(&mut self) -> Result<Option<Offer>, PeeringError>
pub async fn receive_offer(&mut self) -> Result<Option<Offer>, PeeringError>
The serving side: read the pulling side’s opening offer, before anything is listed.
None when the pair negotiated a protocol below OFFER_EXCHANGE_PROTOCOL (an older
peer sends no opening, and nothing is read), or when the peer said it offers nothing. An
offer is at most MAX_OFFER_PAGES pages, each a data frame decoded by
decode_offer_page, and all of them must carry the same cursor.
§Errors
PeeringError::Codec for an opening read twice, a frame that is not an offer, too
many pages, or a malformed page; PeeringError::PeerRefused when the peer refused the
session; or the channel’s I/O or timeout failure.
Sourcepub fn peer(&self) -> &VerifiedPeer
pub fn peer(&self) -> &VerifiedPeer
The peer the handshake verified. Every authorization on this channel is decided against this identity, never against a device id a frame claims.
Sourcepub fn into_peer(self) -> VerifiedPeer
pub fn into_peer(self) -> VerifiedPeer
The verified peer, dropping the stream (closing the channel).
Sourcepub fn with_io_timeout(self, timeout: Duration) -> Self
pub fn with_io_timeout(self, timeout: Duration) -> Self
Bound every later frame read and write by timeout instead of DEFAULT_IO_TIMEOUT.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PeerChannel
impl !RefUnwindSafe for PeerChannel
impl !UnwindSafe for PeerChannel
impl Send for PeerChannel
impl Sync for PeerChannel
impl Unpin for PeerChannel
impl UnsafeUnpin for PeerChannel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more