mirror of
https://github.com/sadoyan/aralez.git
synced 2026-04-30 23:08:40 +08:00
reStructurization of files
This commit is contained in:
@@ -19,15 +19,13 @@ pub struct LB {
|
|||||||
pub ump_full: Arc<UpstreamsDashMap>,
|
pub ump_full: Arc<UpstreamsDashMap>,
|
||||||
pub ump_byid: Arc<UpstreamsIdMap>,
|
pub ump_byid: Arc<UpstreamsIdMap>,
|
||||||
pub headers: Arc<Headers>,
|
pub headers: Arc<Headers>,
|
||||||
// pub config: Arc<DashMap<String, String>>,
|
|
||||||
pub config: Arc<AppConfig>,
|
pub config: Arc<AppConfig>,
|
||||||
pub local: Arc<(String, u16)>,
|
pub local: Arc<(String, u16)>,
|
||||||
pub proxyconf: Arc<DashMap<String, Vec<String>>>,
|
pub proxyconf: Arc<DashMap<String, Vec<String>>>,
|
||||||
// pub extraparams: Arc<Mutex<Extraparams>>,
|
|
||||||
pub extraparams: Arc<RwLock<Extraparams>>,
|
pub extraparams: Arc<RwLock<Extraparams>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MyCtx {
|
pub struct Context {
|
||||||
backend_id: String,
|
backend_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,9 +33,9 @@ pub struct MyCtx {
|
|||||||
impl ProxyHttp for LB {
|
impl ProxyHttp for LB {
|
||||||
// type CTX = ();
|
// type CTX = ();
|
||||||
// fn new_ctx(&self) -> Self::CTX {}
|
// fn new_ctx(&self) -> Self::CTX {}
|
||||||
type CTX = MyCtx;
|
type CTX = Context;
|
||||||
fn new_ctx(&self) -> Self::CTX {
|
fn new_ctx(&self) -> Self::CTX {
|
||||||
MyCtx { backend_id: String::new() }
|
Context { backend_id: String::new() }
|
||||||
}
|
}
|
||||||
async fn upstream_peer(&self, session: &mut Session, _ctx: &mut Self::CTX) -> Result<Box<HttpPeer>> {
|
async fn upstream_peer(&self, session: &mut Session, _ctx: &mut Self::CTX) -> Result<Box<HttpPeer>> {
|
||||||
let host_name = return_header_host(&session);
|
let host_name = return_header_host(&session);
|
||||||
@@ -46,14 +44,6 @@ impl ProxyHttp for LB {
|
|||||||
Some(host) => {
|
Some(host) => {
|
||||||
// session.req_header_mut().headers.insert("X-Host-Name", host.to_string().parse().unwrap());
|
// session.req_header_mut().headers.insert("X-Host-Name", host.to_string().parse().unwrap());
|
||||||
|
|
||||||
// let mut backend_id = Option::<&str>::None;
|
|
||||||
// if let Some(_) = self.config.get("sticky_sessions") {
|
|
||||||
// if let Some(cookies) = session.req_header().headers.get("cookie") {
|
|
||||||
// let cookie_str = cookies.to_str().unwrap_or("").split(" ").collect::<Vec<&str>>()[1];
|
|
||||||
// backend_id = Some(cookie_str);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
let mut backend_id = None;
|
let mut backend_id = None;
|
||||||
{
|
{
|
||||||
let read_guard = self.extraparams.read().await;
|
let read_guard = self.extraparams.read().await;
|
||||||
|
|||||||
Reference in New Issue
Block a user