use libp2p::{Multiaddr, PeerId};
use std::fmt::Debug;
use tokio::sync::{mpsc, watch};
mod config;
mod launch;
mod message;
mod methods;
mod run;
mod utilities;
pub use self::message::Message;
pub use self::message::PeerMessage;
use crate::shoji::ShojiCommand;
use crate::swarm::Swarm;
use crate::Shoji;
pub use config::SatelliteConfig;
#[derive(Debug, Clone)]
pub enum TatamiEvent {
None,
ConnectionEstablished(PeerId),
ConnectionClosed(PeerId),
UndiagnosedEvent,
NewListenAddress(Multiaddr),
MessageReceived(PeerMessage),
}
pub struct Satellite {
pub shoji: Shoji,
swarm: Swarm,
shoji_command_reciever: mpsc::Receiver<ShojiCommand>,
event_sender: watch::Sender<TatamiEvent>,
config: SatelliteConfig,
}
impl Debug for Satellite {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Satellite")
.field("shoji", &self.shoji)
.field("shoji_command_reciever", &self.shoji_command_reciever)
.field("event_sender", &self.event_sender)
.finish()
}
}