Packages

Elixir NIF wrapper for the Reticulum cryptographic mesh networking stack.

Current section

Files

Jump to
ex_reticulum native ex_reticulum_nif src resources.rs
Raw

native/ex_reticulum_nif/src/resources.rs

use std::sync::Mutex;
use reticulum::destination::SingleInputDestination;
use reticulum::destination::link::Link;
use reticulum::hash::AddressHash;
use reticulum::identity::{Identity, PrivateIdentity};
use reticulum::transport::Transport;
pub enum IdentityKind {
Private(PrivateIdentity),
Public(Identity),
}
pub struct IdentityResource(pub Mutex<IdentityKind>);
#[rustler::resource_impl]
impl rustler::Resource for IdentityResource {}
pub struct TransportResource {
pub transport: Mutex<Transport>,
}
#[rustler::resource_impl]
impl rustler::Resource for TransportResource {}
pub struct DestinationResource {
pub destination: std::sync::Arc<tokio::sync::Mutex<SingleInputDestination>>,
pub address_hash: AddressHash,
}
#[rustler::resource_impl]
impl rustler::Resource for DestinationResource {}
pub struct LinkResource {
pub link: std::sync::Arc<tokio::sync::Mutex<Link>>,
pub id: AddressHash,
}
#[rustler::resource_impl]
impl rustler::Resource for LinkResource {}