mirror of
https://github.com/sadoyan/aralez.git
synced 2026-04-30 23:08:40 +08:00
Removed unnecessary protocol declaration.
This commit is contained in:
@@ -46,3 +46,12 @@ upstreams:
|
|||||||
ssl: false
|
ssl: false
|
||||||
servers:
|
servers:
|
||||||
- "192.168.1.5:8080"
|
- "192.168.1.5:8080"
|
||||||
|
# 127.0.0.1:
|
||||||
|
# paths:
|
||||||
|
# "/camerastatus":
|
||||||
|
# ssl: false
|
||||||
|
# headers:
|
||||||
|
# - "X-Some-Thing:Yaaaaaaaaaaaaaaa"
|
||||||
|
# - "X-Prox-From:Hopaaaaaaaaaaaar"
|
||||||
|
# servers:
|
||||||
|
# - "192.168.1.5:8080"
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|||||||
@@ -180,22 +180,7 @@ impl ProxyHttp for LB {
|
|||||||
where
|
where
|
||||||
Self::CTX: Send + Sync,
|
Self::CTX: Send + Sync,
|
||||||
{
|
{
|
||||||
// -------------------------------------------------------------------------------------------- //
|
|
||||||
// let header_host = _session.req_header().headers.get("host");
|
|
||||||
// match header_host {
|
|
||||||
// Some(header_host) => {
|
|
||||||
// let data = self.ump_full.get(header_host.to_str().unwrap()).unwrap();
|
|
||||||
// let detail = data.get(_session.req_header().uri.path());
|
|
||||||
// let thelast = detail.unwrap().value().0[0].clone().3;
|
|
||||||
// println!(" Host ==> {}", thelast);
|
|
||||||
// }
|
|
||||||
// None => {}
|
|
||||||
// }
|
|
||||||
// _upstream_response.insert_header("X-DoSome-About", "Yaaaaaaaaaaaaaaa").unwrap();
|
|
||||||
// -------------------------------------------------------------------------------------------- //
|
|
||||||
|
|
||||||
_upstream_response.insert_header("X-Proxied-From", "Fooooooooooooooo").unwrap();
|
_upstream_response.insert_header("X-Proxied-From", "Fooooooooooooooo").unwrap();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user