diff --git a/waku/src/events/mod.rs b/waku/src/events/mod.rs index abe0784..a9182ce 100644 --- a/waku/src/events/mod.rs +++ b/waku/src/events/mod.rs @@ -30,6 +30,9 @@ impl Signal { } } +/// Waku event +/// For now just WakuMessage is supported +#[non_exhaustive] #[derive(Serialize, Deserialize)] #[serde(tag = "untagged", rename_all = "camelCase")] pub enum Event { diff --git a/waku/src/general/mod.rs b/waku/src/general/mod.rs index b5120cb..80b08fb 100644 --- a/waku/src/general/mod.rs +++ b/waku/src/general/mod.rs @@ -11,9 +11,11 @@ use sscanf::{scanf, RegexRepresentation}; // internal use crate::decrypt::{waku_decode_asymmetric, waku_decode_symmetric}; +/// Waku message version pub type WakuMessageVersion = usize; /// Base58 encoded peer id pub type PeerId = String; +/// Waku message id, hex encoded sha256 digest of the message pub type MessageId = String; /// JsonResponse wrapper. @@ -244,6 +246,7 @@ pub struct MessageIndex { pub pubsub_topic: WakuPubSubTopic, } +/// WakuMessage encoding scheme #[derive(Copy, Clone)] pub enum Encoding { Proto, @@ -279,6 +282,7 @@ impl RegexRepresentation for Encoding { const REGEX: &'static str = r"\w"; } +/// A waku content topic `/{application_name}/{version}/{content_topic_name}/{encdoing}` #[derive(Clone)] pub struct WakuContentTopic { pub application_name: String, @@ -342,6 +346,7 @@ impl<'de> Deserialize<'de> for WakuContentTopic { } } +/// A waku pubsub topic in the form of `/waku/v2/{topic_name}/{encoding}` #[derive(Clone)] pub struct WakuPubSubTopic { pub topic_name: String, diff --git a/waku/src/node/peers.rs b/waku/src/node/peers.rs index c739d22..094c1ef 100644 --- a/waku/src/node/peers.rs +++ b/waku/src/node/peers.rs @@ -113,6 +113,12 @@ pub fn waku_peer_count() -> Result { result.into() } +/// Waku peer supported protocol +/// +/// Examples: +/// `"/ipfs/id/1.0.0"` +/// `"/vac/waku/relay/2.0.0"` +/// `"/ipfs/ping/1.0.0"` pub type Protocol = String; /// Peer data from known/connected waku nodes