BusMessage

This commit is contained in:
Mike Dilger 2022-12-20 18:34:39 +13:00
parent 7c72e5befe
commit 3988efce54
2 changed files with 28 additions and 0 deletions

26
src/comms.rs Normal file
View File

@ -0,0 +1,26 @@
use std::ops::Drop;
use serde::Serialize;
use zeroize::Zeroize;
/// This is a message sent between the Overlord and Minions
/// in either direction
#[derive(Debug, Clone, Serialize)]
pub struct BusMessage {
/// Indended recipient of the message
pub target: String,
/// What kind of message is this
pub kind: String,
/// The payload, serialized as a JSON string
pub json_payload: String,
}
/// We may send passwords through BusMessage objects, so we zeroize
/// bus message payloads upon drop.
impl Drop for BusMessage {
fn drop(&mut self) {
self.json_payload.zeroize();
}
}

View File

@ -1,3 +1,5 @@
mod comms;
fn main() {
tracing_subscriber::fmt::init();
}