Removed unnecessary protocol declaration.

This commit is contained in:
Ara Sadoyan
2025-03-20 18:57:33 +01:00
parent cafe18b02e
commit 338bfa43d7
3 changed files with 10 additions and 83 deletions

View File

@@ -92,70 +92,3 @@ pub async fn watch_file(fp: String, mut toreturn: Sender<UpstreamsDashMap>) {
}
}
}
/*
#[allow(dead_code)]
pub fn build_upstreams(d: &str, kind: &str) -> UpstreamsDashMap {
let upstreams: UpstreamsDashMap = DashMap::new();
let mut contents = d.to_string();
match kind {
"filepath" => {
let _ = match fs::read_to_string(d) {
Ok(data) => {
println!("Reading upstreams from {}", d);
contents = data
}
Err(e) => {
error!("Reading upstreams file: {:?}", e);
return upstreams;
}
};
}
"content" => {
println!("Reading upstreams from API post body");
}
_ => println!("*******************> nothing <*******************"),
}
for line in contents.lines().filter(|line| !line.trim().is_empty()) {
let mut parts = line.split_whitespace();
let Some(hostname) = parts.next() else {
continue;
};
let Some(ssl) = string_to_bool(parts.next()) else {
continue;
};
let Some(proto) = parts.next() else {
continue;
};
let Some(path) = parts.next() else {
continue;
};
let Some(address) = parts.next() else {
continue;
};
let mut addr_parts = address.split(':');
let Some(ip) = addr_parts.next() else {
continue;
};
let Some(port_str) = addr_parts.next() else {
continue;
};
let Ok(port) = port_str.parse::<u16>() else {
continue;
};
let entry = upstreams.entry(hostname.to_string()).or_insert_with(DashMap::new);
entry
.entry(path.to_string())
.or_insert_with(|| (Vec::new(), AtomicUsize::new(0)))
.0
.push((ip.to_string(), port, ssl, proto.to_string()));
}
upstreams
}
*/