aboutsummaryrefslogtreecommitdiff
path: root/src/consul_actor.rs
diff options
context:
space:
mode:
authordarkgallium <florian+git@aloneinthedark.xyz>2020-05-24 20:40:49 +0200
committerdarkgallium <florian+git@aloneinthedark.xyz>2020-05-24 20:40:49 +0200
commitd2ae084fc1be2671c2a301e689c8632576922785 (patch)
treefb340afde570ffacf42f9349df135624fcb4178f /src/consul_actor.rs
parenta2d25820985b04f15f3c0f38cabfd7130124d943 (diff)
downloaddiplonat-d2ae084fc1be2671c2a301e689c8632576922785.tar.gz
diplonat-d2ae084fc1be2671c2a301e689c8632576922785.zip
add actor for firewall & massive refactor
Diffstat (limited to 'src/consul_actor.rs')
-rw-r--r--src/consul_actor.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/consul_actor.rs b/src/consul_actor.rs
index 1cbb1b8..ba5d704 100644
--- a/src/consul_actor.rs
+++ b/src/consul_actor.rs
@@ -8,11 +8,12 @@ use serde::{Serialize, Deserialize};
use serde_lexpr::{from_str,error};
use crate::messages;
use crate::consul;
+use std::collections::HashSet;
#[derive(Serialize, Deserialize, Debug)]
pub enum DiplonatParameter {
- tcp_port(Vec<u16>),
- udp_port(Vec<u16>)
+ tcp_port(HashSet<u16>),
+ udp_port(HashSet<u16>)
}
#[derive(Serialize, Deserialize, Debug)]
@@ -53,8 +54,8 @@ fn to_parameters(catalog: &consul::CatalogNode) -> Vec<DiplonatConsul> {
fn to_open_ports(params: &Vec<DiplonatConsul>) -> messages::PublicExposedPorts {
let mut op = messages::PublicExposedPorts {
- tcp_ports: Vec::new(),
- udp_ports: Vec::new()
+ tcp_ports: HashSet::new(),
+ udp_ports: HashSet::new()
};
for conf in params {
@@ -73,8 +74,8 @@ fn to_open_ports(params: &Vec<DiplonatConsul>) -> messages::PublicExposedPorts {
impl ConsulActor {
pub fn new(url: &str, node: &str) -> Self {
let (tx, rx) = watch::channel(messages::PublicExposedPorts{
- tcp_ports: Vec::new(),
- udp_ports: Vec::new()
+ tcp_ports: HashSet::new(),
+ udp_ports: HashSet::new()
});
return Self {