aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/diplonat.rs27
-rw-r--r--src/main.rs2
2 files changed, 26 insertions, 3 deletions
diff --git a/src/diplonat.rs b/src/diplonat.rs
index 3dd4e91..9062dd7 100644
--- a/src/diplonat.rs
+++ b/src/diplonat.rs
@@ -1,4 +1,5 @@
use anyhow::{Result, Context};
+use tokio::try_join;
use crate::*;
pub struct Diplonat {
@@ -16,7 +17,29 @@ impl Diplonat {
return Ok(ctx);
}
- pub fn listen(&self) -> bool {
- return true;
+ // Action sinks
+ pub async fn consul_catalog(&self) -> Result<()> {
+ info!("Consul catalog loop started");
+ return Ok(());
+ }
+ pub async fn control_loop(&self) -> Result<()> {
+ info!("Control loop started");
+ return Ok(());
+ }
+
+ // Action taps
+ pub async fn igd(&self) -> Result<()> {
+ info!("IGD loop started");
+ return Ok(());
+ }
+ // @TODO: implement netfilter, dns
+
+ pub async fn listen(&self) -> Result<()> {
+ try_join!(
+ self.consul_catalog(),
+ self.control_loop(),
+ self.igd()
+ )?;
+ return Ok(());
}
}
diff --git a/src/main.rs b/src/main.rs
index fee73aa..c8a4b0a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,7 +14,7 @@ async fn main() {
info!("Starting Diplonat");
let diplo = Diplonat::new().await.expect("Setup failed");
- diplo.listen();
+ diplo.listen().await.expect("A runtime error occured");
/*
let url = format!("http://127.0.0.1:8500/v1/catalog/node/{}", config.consul_node_name);
let resp = reqwest::get(&url)