pub struct Libp2pSyncTransport { /* private fields */ }Expand description
A libp2p SyncTransport (native) — a noise-encrypted request-response pipe to a single peer or
relay. It wraps the core-db BlockingSyncClient:
each SyncOperation is serialized to a CBOR op frame on publish and decoded back on pull, so the
wire carries only opaque signed-op bytes. A dumb pipe like the in-memory and HTTP backends — it never
validates or trusts. Undecodable inbound frames are skipped (they could never be admitted anyway;
the fail-closed inbox is the trust boundary), so a hostile peer injecting junk cannot break sync for
well-formed operations.
Implementations§
Source§impl Libp2pSyncTransport
impl Libp2pSyncTransport
Sourcepub fn connect(peer_id: &str, peer_addr: &str) -> Result<Self, String>
pub fn connect(peer_id: &str, peer_addr: &str) -> Result<Self, String>
Connect to peer_addr (a libp2p multiaddr, e.g. /ip4/1.2.3.4/tcp/4001) identified by peer_id
(base58). The connection is established lazily on the first publish/pull.
Sourcepub fn local_peer_id(&self) -> String
pub fn local_peer_id(&self) -> String
This node’s own libp2p peer id (base58) — so a peer can be told how to reach us back.
Trait Implementations§
Source§impl SyncTransport for Libp2pSyncTransport
Available on non-WebAssembly only.
impl SyncTransport for Libp2pSyncTransport
Auto Trait Implementations§
impl !Freeze for Libp2pSyncTransport
impl RefUnwindSafe for Libp2pSyncTransport
impl Send for Libp2pSyncTransport
impl Sync for Libp2pSyncTransport
impl Unpin for Libp2pSyncTransport
impl UnsafeUnpin for Libp2pSyncTransport
impl UnwindSafe for Libp2pSyncTransport
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<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