diff --git a/etc/upstreams.yaml b/etc/upstreams.yaml index 811b1d5..f1b4d81 100644 --- a/etc/upstreams.yaml +++ b/etc/upstreams.yaml @@ -45,4 +45,13 @@ upstreams: "/camerastatus": ssl: false servers: - - "192.168.1.5:8080" \ No newline at end of file + - "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" \ No newline at end of file diff --git a/src/utils/discovery.rs b/src/utils/discovery.rs index 6cb32ff..5f8b5ba 100644 --- a/src/utils/discovery.rs +++ b/src/utils/discovery.rs @@ -92,70 +92,3 @@ pub async fn watch_file(fp: String, mut toreturn: Sender) { } } } - -/* -#[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::() 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 -} -*/ diff --git a/src/web/proxyhttp.rs b/src/web/proxyhttp.rs index e2db32e..f2aae4a 100644 --- a/src/web/proxyhttp.rs +++ b/src/web/proxyhttp.rs @@ -180,22 +180,7 @@ impl ProxyHttp for LB { where 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(); - Ok(()) }