pub struct VpnMeshNetwork {
pub node_id: String,
pub config: VpnMeshConfig,
/* private fields */
}Fields§
§node_id: String§config: VpnMeshConfigImplementations§
Source§impl VpnMeshNetwork
impl VpnMeshNetwork
Sourcepub fn new(
node_id: String,
config: VpnMeshConfig,
bootstrap_urls: Vec<String>,
mdns_enabled: bool,
_mdns_service_name: &str,
peer_timeout_secs: u64,
) -> Result<VpnMeshNetwork, Box<dyn Error>>
pub fn new( node_id: String, config: VpnMeshConfig, bootstrap_urls: Vec<String>, mdns_enabled: bool, _mdns_service_name: &str, peer_timeout_secs: u64, ) -> Result<VpnMeshNetwork, Box<dyn Error>>
Create a new VpnMeshNetwork with the given configuration.
§Arguments
node_id- Unique identifier for this nodeconfig- VPN mesh configurationbootstrap_urls- URLs of bootstrap registry servers for peer discoverymdns_enabled- Whether to enable mDNS discovery_mdns_service_name- Service name for mDNS registrationpeer_timeout_secs- Timeout for peer communication
§Returns
Result with VpnMeshNetwork instance or error
Trait Implementations§
Source§impl PeerNetwork for VpnMeshNetwork
impl PeerNetwork for VpnMeshNetwork
fn node_id(&self) -> &String
fn discover_peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>, TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
VpnMeshNetwork: 'async_trait,
fn broadcast_challenge<'life0, 'life1, 'async_trait>(
&'life0 self,
challenge: &'life1 Challenge,
) -> Pin<Box<dyn Future<Output = Result<(), TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
fn relay_proof<'life0, 'life1, 'async_trait>(
&'life0 self,
proof: &'life1 ProofPayload,
) -> Pin<Box<dyn Future<Output = Result<(), TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
fn sync_state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<NetworkState, TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
VpnMeshNetwork: 'async_trait,
Source§fn pull_lattice<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_url: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
fn pull_lattice<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_url: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
Pull the hexchain lattice snapshot from a peer by URL.
Returns
None if the peer is unreachable or returns non-200.Source§fn push_lattice<'life0, 'life1, 'async_trait>(
&'life0 self,
snapshot: &'life1 Value,
) -> Pin<Box<dyn Future<Output = Result<usize, TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
fn push_lattice<'life0, 'life1, 'async_trait>(
&'life0 self,
snapshot: &'life1 Value,
) -> Pin<Box<dyn Future<Output = Result<usize, TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
Push the local hexchain lattice snapshot to all known peers.
Returns count of successful pushes.
Source§fn broadcast_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 Value,
) -> Pin<Box<dyn Future<Output = Result<(), TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
fn broadcast_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 Value,
) -> Pin<Box<dyn Future<Output = Result<(), TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
Broadcast a transaction to all known peers so they can add it to their mempool.
Source§fn register_with_bootstrap<'life0, 'life1, 'async_trait>(
&'life0 self,
cfg: &'life1 RegistrationConfig,
) -> Pin<Box<dyn Future<Output = Result<(), TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
fn register_with_bootstrap<'life0, 'life1, 'async_trait>(
&'life0 self,
cfg: &'life1 RegistrationConfig,
) -> Pin<Box<dyn Future<Output = Result<(), TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
Register this node with bootstrap registry URL(s).
Default is no-op; VpnMeshNetwork overrides with HTTP POST.
Source§fn broadcast_block<'life0, 'life1, 'async_trait>(
&'life0 self,
proof: &'life1 Value,
) -> Pin<Box<dyn Future<Output = Result<usize, TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
fn broadcast_block<'life0, 'life1, 'async_trait>(
&'life0 self,
proof: &'life1 Value,
) -> Pin<Box<dyn Future<Output = Result<usize, TribeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VpnMeshNetwork: 'async_trait,
Broadcast a newly produced block to all known peer validators.
Returns count of successful broadcasts.
Auto Trait Implementations§
impl !RefUnwindSafe for VpnMeshNetwork
impl !UnwindSafe for VpnMeshNetwork
impl Freeze for VpnMeshNetwork
impl Send for VpnMeshNetwork
impl Sync for VpnMeshNetwork
impl Unpin for VpnMeshNetwork
impl UnsafeUnpin for VpnMeshNetwork
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
Mutably borrows from an owned value. Read more