pub struct IrohTransportConfig {
pub secret_key_hex: Option<String>,
pub relay_mode: RelayModeSetting,
}Expand description
Persistable configuration for the Iroh transport.
This configuration is stored in the _sync database’s transport_configs
subtree and is automatically loaded when enable_iroh_transport() is called.
The most important field is secret_key_hex, which stores the node’s
cryptographic identity. When this is persisted, the node will have the
same address across restarts.
§Example
use eidetica::sync::transports::iroh::IrohTransportConfig;
// Create a default config (secret key will be generated on first use)
let config = IrohTransportConfig::default();
// Or create with specific settings
let config = IrohTransportConfig {
relay_mode: RelayModeSetting::Disabled,
..Default::default()
};Fields§
§secret_key_hex: Option<String>Secret key bytes (hex encoded for JSON storage).
When None, a new secret key will be generated on first use
and stored back to the config. Once set, this ensures the node
maintains the same identity (and thus address) across restarts.
relay_mode: RelayModeSettingRelay mode setting for NAT traversal.
Implementations§
Source§impl IrohTransportConfig
impl IrohTransportConfig
Sourcepub fn get_or_create_secret_key(&mut self) -> SecretKey
pub fn get_or_create_secret_key(&mut self) -> SecretKey
Get the secret key from config, or generate a new one.
If a secret key is already stored in the config, it will be decoded and returned. Otherwise, a new random secret key is generated, stored in the config (as hex), and returned.
This method mutates the config to store the newly generated key, so the caller should persist the config after calling this.
Sourcepub fn has_secret_key(&self) -> bool
pub fn has_secret_key(&self) -> bool
Check if a secret key has been set in this config.
Trait Implementations§
Source§impl Clone for IrohTransportConfig
impl Clone for IrohTransportConfig
Source§fn clone(&self) -> IrohTransportConfig
fn clone(&self) -> IrohTransportConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IrohTransportConfig
impl Debug for IrohTransportConfig
Source§impl Default for IrohTransportConfig
impl Default for IrohTransportConfig
Source§impl<'de> Deserialize<'de> for IrohTransportConfig
impl<'de> Deserialize<'de> for IrohTransportConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Registered for IrohTransportConfig
impl Registered for IrohTransportConfig
Source§impl Serialize for IrohTransportConfig
impl Serialize for IrohTransportConfig
impl TransportConfig for IrohTransportConfig
Auto Trait Implementations§
impl Freeze for IrohTransportConfig
impl RefUnwindSafe for IrohTransportConfig
impl Send for IrohTransportConfig
impl Sync for IrohTransportConfig
impl Unpin for IrohTransportConfig
impl UnwindSafe for IrohTransportConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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