ip hashing + test
This commit is contained in:
@@ -6,7 +6,19 @@ pub mod ip_hashing;
|
||||
use std::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
use crate::backend::Backend;
|
||||
use std::cell::RefCell;
|
||||
use std::net::{SocketAddr};
|
||||
|
||||
thread_local! {
|
||||
pub static CURRENT_CONNECTION_INFO: RefCell<Option<ConnectionInfo>> = RefCell::new(None);
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ConnectionInfo {
|
||||
pub client_ip : SocketAddr,
|
||||
}
|
||||
|
||||
pub trait Balancer: Debug + Send + Sync + 'static {
|
||||
fn choose_backend(&mut self) -> Option<Arc<Backend>>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user