IronForce is a decentralized network, Degeon is a messenger built on it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.4 KiB

use alloc::vec::Vec;
use crate::crypto::PublicKey;
use serde::{Serialize, Deserialize};
/// A tunnel that is used for communication
#[derive(Serialize, Clone, Deserialize)]
pub struct Tunnel {
/// Tunnel's id.
/// By the way, this id is `None` until the tunnel is validated in the backward movement
pub id: Option<u64>,
/// Ids, each of them is just for local storage on each node until a final global id is created
pub local_ids: Vec<u64>,
/// Ids of peers (in transport) by which we can send a message - one for backward direction, another for forward
pub peer_ids: (u64, u64),
/// Time at which this tunnel should be destroyed (UNIX epoch)
pub ttd: u64,
/// Public keys of nodes in the tunnel
pub nodes_in_tunnel: Option<Vec<PublicKey>>,
/// Is this tunnel used for multicast?
pub is_multicast: bool,
/// If we created this tunnel, then this is the node that it's used to communicate with
pub target_node: Option<PublicKey>,
}
/// Tunnel, but only the fields that are ok to share
#[derive(Serialize, Clone, Deserialize)]
pub struct TunnelPublic {
/// Tunnel's id
id: Option<u64>,
/// Ids, each of them is just for local storage on each node until a final global id is created
local_ids: Vec<u64>,
/// Time at which this tunnel should be destroyed (UNIX epoch)
ttd: u64,
/// Public keys of nodes in the tunnel
nodes_in_tunnel: Option<Vec<PublicKey>>,
}