aboutsummaryrefslogtreecommitdiff
path: root/src/proxy_config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/proxy_config.rs')
-rw-r--r--src/proxy_config.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/proxy_config.rs b/src/proxy_config.rs
index 891fdef..8c2444a 100644
--- a/src/proxy_config.rs
+++ b/src/proxy_config.rs
@@ -1,5 +1,5 @@
use std::net::SocketAddr;
-use std::sync::Arc;
+use std::sync::{atomic, Arc};
use std::{cmp, time::Duration};
use log::*;
@@ -12,9 +12,15 @@ use crate::consul::*;
#[derive(Debug)]
pub struct ProxyEntry {
pub target_addr: SocketAddr,
+
pub host: String,
pub path_prefix: Option<String>,
pub priority: u32,
+
+ // Counts the number of times this proxy server has been called to
+ // This implements a round-robin load balancer if there are multiple
+ // entries for the same host and same path prefix.
+ pub calls: atomic::AtomicU64,
}
#[derive(Debug)]
@@ -53,6 +59,7 @@ fn parse_tricot_tag(target_addr: SocketAddr, tag: &str) -> Option<ProxyEntry> {
host: host.to_string(),
path_prefix,
priority,
+ calls: atomic::AtomicU64::from(0),
})
}