diff options
author | Alex Auvolat <alex@adnab.me> | 2023-04-04 18:46:14 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-04-04 18:46:14 +0200 |
commit | 615f926618471998f85ee184b378b1128340367b (patch) | |
tree | be9b5d5da3e844460a533bea9fefd452892a7f32 /src/diplonat.rs | |
parent | e64be9e8816b9bd5d3d787d1d5d57d460ae37569 (diff) | |
download | diplonat-615f926618471998f85ee184b378b1128340367b.tar.gz diplonat-615f926618471998f85ee184b378b1128340367b.zip |
Add STUN actor that saves autodiscovered IPv4/IPv6 to Consul
Diffstat (limited to 'src/diplonat.rs')
-rw-r--r-- | src/diplonat.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/diplonat.rs b/src/diplonat.rs index 22ebd6e..6b282eb 100644 --- a/src/diplonat.rs +++ b/src/diplonat.rs @@ -3,12 +3,14 @@ use tokio::try_join; use crate::{ config::ConfigOpts, consul_actor::ConsulActor, fw_actor::FirewallActor, igd_actor::IgdActor, + stun_actor::StunActor, }; pub struct Diplonat { consul: ConsulActor, firewall: FirewallActor, igd: IgdActor, + stun: StunActor, } impl Diplonat { @@ -28,22 +30,30 @@ impl Diplonat { ) .await?; + let sa = StunActor::new( + &rt_cfg.consul, + &rt_cfg.stun, + &rt_cfg.consul.node_name, + ); + let ctx = Self { consul: ca, igd: ia, firewall: fw, + stun: sa, }; - return Ok(ctx); + Ok(ctx) } pub async fn listen(&mut self) -> Result<()> { try_join!( self.consul.listen(), self.igd.listen(), - self.firewall.listen() + self.firewall.listen(), + self.stun.listen(), )?; - return Ok(()); + Ok(()) } } |