deltachat::peer_channels

Struct Iroh

source
pub struct Iroh {
    pub(crate) endpoint: Endpoint,
    pub(crate) gossip: Gossip,
    pub(crate) sequence_numbers: Mutex<HashMap<TopicId, i32>>,
    pub(crate) iroh_channels: RwLock<HashMap<TopicId, ChannelState>>,
    pub(crate) public_key: PublicKey,
}
Expand description

Store iroh peer channels for the context.

Fields§

§endpoint: Endpoint

[Endpoint] needed for iroh peer channels.

§gossip: Gossip

[Gossip] needed for iroh peer channels.

§sequence_numbers: Mutex<HashMap<TopicId, i32>>

Sequence numbers for gossip channels.

§iroh_channels: RwLock<HashMap<TopicId, ChannelState>>

Topics for which an advertisement has already been sent.

§public_key: PublicKey

Currently used Iroh public key.

This is attached to every message to work around iroh_gossip deduplication.

Implementations§

source§

impl Iroh

source

pub(crate) async fn network_change(&self)

Notify the endpoint that the network has changed.

source

pub(crate) async fn close(self) -> Result<()>

Closes the QUIC endpoint.

source

async fn join_and_subscribe_gossip( &self, ctx: &Context, msg_id: MsgId, ) -> Result<Option<Receiver<()>>>

Join a topic and create the subscriber loop for it.

If there is no gossip, create it.

The returned future resolves when the swarm becomes operational.

source

pub async fn maybe_add_gossip_peers( &self, topic: TopicId, peers: Vec<NodeAddr>, ) -> Result<()>

Add gossip peers to realtime channel if it is already active.

source

pub async fn send_webxdc_realtime_data( &self, ctx: &Context, msg_id: MsgId, data: Vec<u8>, ) -> Result<()>

Send realtime data to the gossip swarm.

source

fn get_and_incr(&self, topic: &TopicId) -> i32

source

pub(crate) async fn get_node_addr(&self) -> Result<NodeAddr>

Get the iroh [NodeAddr] without direct IP addresses.

source

pub(crate) async fn leave_realtime(&self, topic: TopicId) -> Result<()>

Leave the realtime channel for a given topic.

Trait Implementations§

source§

impl Debug for Iroh

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Iroh

§

impl !RefUnwindSafe for Iroh

§

impl Send for Iroh

§

impl Sync for Iroh

§

impl Unpin for Iroh

§

impl !UnwindSafe for Iroh

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T