rustfmt, fixed ip hash issue

This commit is contained in:
psun256
2025-12-10 03:03:10 -05:00
parent 90d326ba33
commit 9fb423b949
11 changed files with 150 additions and 239 deletions

View File

@@ -1,24 +1,18 @@
pub mod round_robin;
pub mod adaptive_weight;
pub mod least_connections;
pub mod ip_hashing;
pub mod least_connections;
pub mod round_robin;
use std::fmt::Debug;
use std::sync::Arc;
use crate::backend::Backend;
use std::cell::RefCell;
use std::net::{SocketAddr};
use std::fmt::Debug;
use std::net::IpAddr;
use std::sync::Arc;
thread_local! {
pub static CURRENT_CONNECTION_INFO: RefCell<Option<ConnectionInfo>> = RefCell::new(None);
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug)]
pub struct ConnectionInfo {
pub client_ip : SocketAddr,
pub client_ip: IpAddr,
}
pub trait Balancer: Debug + Send + Sync + 'static {
fn choose_backend(&mut self) -> Option<Arc<Backend>>;
fn choose_backend(&mut self, ctx: ConnectionInfo) -> Option<Arc<Backend>>;
}