mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
BusMessage
This commit is contained in:
parent
7c72e5befe
commit
3988efce54
26
src/comms.rs
Normal file
26
src/comms.rs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
mod comms;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user