diff --git a/crates/utils/src/http/ip.rs b/crates/utils/src/http/ip.rs index 1056e952..3e03f501 100644 --- a/crates/utils/src/http/ip.rs +++ b/crates/utils/src/http/ip.rs @@ -60,10 +60,12 @@ pub struct TrustedProxies { impl TrustedProxies { /// Create a new TrustedProxies configuration pub fn new(cidrs: Vec, enable_validation: bool, max_chain_length: usize) -> Self { - let cidrs = cidrs.into_iter() - .filter_map(|s| s.parse::().ok()) - .collect(); - Self { cidrs, enable_validation, max_chain_length } + let cidrs = cidrs.into_iter().filter_map(|s| s.parse::().ok()).collect(); + Self { + cidrs, + enable_validation, + max_chain_length, + } } /// Check if an IP address is within the trusted proxy ranges @@ -310,11 +312,7 @@ mod tests { #[test] fn test_trusted_proxies_validation() { - let trusted_proxies = TrustedProxies::new( - vec!["192.168.1.0/24".to_string(), "10.0.0.0/8".to_string()], - true, - 5, - ); + let trusted_proxies = TrustedProxies::new(vec!["192.168.1.0/24".to_string(), "10.0.0.0/8".to_string()], true, 5); // Trusted IPs assert!(trusted_proxies.is_trusted_proxy("192.168.1.1".parse().unwrap())); @@ -395,6 +393,9 @@ mod tests { assert!(is_valid_client_ip("203.0.113.1, 198.51.100.1", 5)); // Invalid chain (too long) - assert!(!is_valid_client_ip("203.0.113.1, 198.51.100.1, 192.0.2.1, 192.0.2.2, 192.0.2.3, 192.0.2.4", 5)); + assert!(!is_valid_client_ip( + "203.0.113.1, 198.51.100.1, 192.0.2.1, 192.0.2.2, 192.0.2.3, 192.0.2.4", + 5 + )); } -} \ No newline at end of file +} diff --git a/rustfs/src/main.rs b/rustfs/src/main.rs index 38a85518..92c5e4a4 100644 --- a/rustfs/src/main.rs +++ b/rustfs/src/main.rs @@ -329,14 +329,14 @@ async fn run(opt: config::Opt) -> Result<()> { init_update_check(); + info!(target: "rustfs::main::run","server started successfully at {}", &server_address); + // 4. Mark as Full Ready now that critical components are warm + readiness.mark_stage(SystemStage::FullReady); println!( "RustFS server started successfully at {}, current time: {}", &server_address, chrono::offset::Utc::now().to_string() ); - info!(target: "rustfs::main::run","server started successfully at {}", &server_address); - // 4. Mark as Full Ready now that critical components are warm - readiness.mark_stage(SystemStage::FullReady); // Perform hibernation for 1 second tokio::time::sleep(SHUTDOWN_TIMEOUT).await;