pub struct IrohTransport { /* private fields */ }Expand description
Iroh transport implementation using QUIC peer-to-peer networking.
Provides NAT traversal and direct peer-to-peer connectivity using the Iroh protocol. Supports both relay-assisted and direct connections.
§How It Works
- Discovery: Peers find each other via relay servers or direct addresses
- Connection: Attempts direct connection through NAT hole-punching
- Fallback: Uses relay servers if direct connection fails
- Upgrade: Automatically upgrades to direct connection when possible
§Server Addresses
Addresses use iroh’s standard EndpointTicket format (postcard + base32-lower
with endpoint prefix) for both get_server_address() and DatabaseTicket URLs.
§Example
use eidetica::sync::transports::iroh::IrohTransport;
use iroh::RelayMode;
// Create with defaults (production relay servers)
let transport = IrohTransport::new()?;
// Or use the builder for custom configuration
let transport = IrohTransport::builder()
.relay_mode(RelayMode::Staging)
.build()?;Implementations§
Source§impl IrohTransport
impl IrohTransport
Sourcepub const TRANSPORT_TYPE: &'static str = "iroh"
pub const TRANSPORT_TYPE: &'static str = "iroh"
Transport type identifier for Iroh
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new Iroh transport instance with production defaults.
Uses RelayMode::Default which connects to n0’s production relay
infrastructure. For custom configuration, use IrohTransport::builder().
The endpoint will be lazily initialized on first use.
§Example
use eidetica::sync::transports::iroh::IrohTransport;
let transport = IrohTransport::new()?;
// Use with: sync.enable_iroh_transport_with_config(transport)?;Sourcepub fn builder() -> IrohTransportBuilder
pub fn builder() -> IrohTransportBuilder
Create a builder for configuring the transport.
Allows customization of relay modes and other transport options.
§Example
use eidetica::sync::transports::iroh::IrohTransport;
use iroh::RelayMode;
let transport = IrohTransport::builder()
.relay_mode(RelayMode::Disabled)
.build()?;Trait Implementations§
Source§impl SyncTransport for IrohTransport
impl SyncTransport for IrohTransport
Source§fn transport_type(&self) -> &'static str
fn transport_type(&self) -> &'static str
Source§fn can_handle_address(&self, address: &Address) -> bool
fn can_handle_address(&self, address: &Address) -> bool
Source§fn start_server<'life0, 'async_trait>(
&'life0 mut self,
handler: Arc<dyn SyncHandler>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start_server<'life0, 'async_trait>(
&'life0 mut self,
handler: Arc<dyn SyncHandler>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn stop_server<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop_server<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn send_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
address: &'life1 Address,
request: &'life2 SyncRequest,
) -> Pin<Box<dyn Future<Output = Result<SyncResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
address: &'life1 Address,
request: &'life2 SyncRequest,
) -> Pin<Box<dyn Future<Output = Result<SyncResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn is_server_running(&self) -> bool
fn is_server_running(&self) -> bool
Source§fn get_server_address(&self) -> Result<String>
fn get_server_address(&self) -> Result<String>
Source§fn send_entries<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
address: &'life1 Address,
entries: &'life2 [Entry],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_entries<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
address: &'life1 Address,
entries: &'life2 [Entry],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl Freeze for IrohTransport
impl !RefUnwindSafe for IrohTransport
impl Send for IrohTransport
impl Sync for IrohTransport
impl Unpin for IrohTransport
impl UnsafeUnpin for IrohTransport
impl !UnwindSafe for IrohTransport
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<T> CompatExt for T
impl<T> CompatExt for 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