This commit is contained in:
John Smith
2023-05-13 20:36:52 -04:00
parent cb899b44ea
commit 5eb2ea656c
17 changed files with 2745 additions and 2261 deletions

View File

@@ -1562,7 +1562,7 @@ impl NetworkManager {
if let Some(nr) = routing_table.lookup_node_ref(k) {
let peer_stats = nr.peer_stats();
let peer = PeerTableData {
node_ids: nr.node_ids().iter().map(|x| x.to_string()).collect(),
node_ids: nr.node_ids().iter().copied().collect(),
peer_address: v.last_connection.remote().to_string(),
peer_stats,
};

View File

@@ -8,18 +8,18 @@ use super::*;
pub struct VeilidAppMessage {
/// Some(sender) if the message was sent directly, None if received via a private/safety route
#[serde(with = "opt_json_as_string")]
sender: Option<PublicKey>,
sender: Option<TypedKey>, xxx continue propagating this publickey->typedkey and get all the FFI done
/// The content of the message to deliver to the application
#[serde(with = "json_as_base64")]
message: Vec<u8>,
}
impl VeilidAppMessage {
pub fn new(sender: Option<PublicKey>, message: Vec<u8>) -> Self {
pub fn new(sender: Option<TypedKey>, message: Vec<u8>) -> Self {
Self { sender, message }
}
pub fn sender(&self) -> Option<&PublicKey> {
pub fn sender(&self) -> Option<&TypedKey> {
self.sender.as_ref()
}
pub fn message(&self) -> &[u8] {
@@ -35,7 +35,7 @@ impl VeilidAppMessage {
pub struct VeilidAppCall {
/// Some(sender) if the request was sent directly, None if received via a private/safety route
#[serde(with = "opt_json_as_string")]
sender: Option<PublicKey>,
sender: Option<TypedKey>,
/// The content of the request to deliver to the application
#[serde(with = "json_as_base64")]
message: Vec<u8>,
@@ -45,7 +45,7 @@ pub struct VeilidAppCall {
}
impl VeilidAppCall {
pub fn new(sender: Option<PublicKey>, message: Vec<u8>, id: OperationId) -> Self {
pub fn new(sender: Option<TypedKey>, message: Vec<u8>, id: OperationId) -> Self {
Self {
sender,
message,
@@ -53,7 +53,7 @@ impl VeilidAppCall {
}
}
pub fn sender(&self) -> Option<&PublicKey> {
pub fn sender(&self) -> Option<&TypedKey> {
self.sender.as_ref()
}
pub fn message(&self) -> &[u8] {

View File

@@ -74,7 +74,7 @@ pub struct VeilidStateAttachment {
)]
#[archive_attr(repr(C), derive(CheckBytes))]
pub struct PeerTableData {
pub node_ids: Vec<String>,
pub node_ids: Vec<TypedKey>,
pub peer_address: String,
pub peer_stats: PeerStats,
}