diff --git a/volo-http/src/server/extract.rs b/volo-http/src/server/extract.rs index 9084c61c..315aaae3 100644 --- a/volo-http/src/server/extract.rs +++ b/volo-http/src/server/extract.rs @@ -23,7 +23,7 @@ use crate::{ context::ServerContext, error::server::{body_collection_error, ExtractBodyError}, request::{Request, RequestPartsExt}, - server::layer::ClientIP, + server::utils::client_ip::ClientIP, utils::macros::impl_deref_and_deref_mut, }; diff --git a/volo-http/src/server/layer/mod.rs b/volo-http/src/server/layer/mod.rs index 585f8faa..6b5d22b0 100644 --- a/volo-http/src/server/layer/mod.rs +++ b/volo-http/src/server/layer/mod.rs @@ -1,11 +1,9 @@ //! Collections of some useful `Layer`s. mod body_limit; -mod client_ip; mod filter; mod timeout; pub use body_limit::BodyLimitLayer; -pub use client_ip::{ClientIP, ClientIPConfig, ClientIPLayer}; pub use filter::FilterLayer; pub use timeout::TimeoutLayer; diff --git a/volo-http/src/server/layer/client_ip.rs b/volo-http/src/server/utils/client_ip.rs similarity index 95% rename from volo-http/src/server/layer/client_ip.rs rename to volo-http/src/server/utils/client_ip.rs index e52761a1..515cae9b 100644 --- a/volo-http/src/server/layer/client_ip.rs +++ b/volo-http/src/server/utils/client_ip.rs @@ -77,7 +77,7 @@ impl ClientIPConfig { /// # Example /// /// ```rust - /// use volo_http::server::layer::ClientIPConfig; + /// use volo_http::server::utils::client_ip::ClientIPConfig; /// /// let client_ip_config = /// ClientIPConfig::new().with_remote_ip_headers(vec!["X-Real-IP", "X-Forwarded-For"]); @@ -110,7 +110,7 @@ impl ClientIPConfig { /// # Example /// /// ```rust - /// use volo_http::server::layer::ClientIPConfig; + /// use volo_http::server::utils::client_ip::ClientIPConfig; /// /// let client_ip_config = ClientIPConfig::new() /// .with_trusted_cidrs(vec!["0.0.0.0/0".parse().unwrap(), "::/0".parse().unwrap()]); @@ -145,10 +145,10 @@ impl ClientIPConfig { /// /// ```rust /// /// -/// use volo_http::server::layer::ClientIP; +/// use volo_http::server::utils::client_ip::ClientIP; /// use volo_http::server::{ -/// layer::{ClientIPConfig, ClientIPLayer}, /// route::{get, Router}, +/// utils::client_ip::{ClientIPConfig, ClientIPLayer}, /// Server, /// }; /// @@ -168,8 +168,8 @@ impl ClientIPConfig { /// use volo_http::{ /// context::ServerContext, /// server::{ -/// layer::{ClientIP, ClientIPConfig, ClientIPLayer}, /// route::{get, Router}, +/// utils::client_ip::{ClientIP, ClientIPConfig, ClientIPLayer}, /// Server, /// }, /// }; @@ -275,8 +275,8 @@ mod client_ip_tests { body::BodyConversion, context::ServerContext, server::{ - layer::{client_ip::ClientIPLayer, ClientIP, ClientIPConfig}, route::{get, Route}, + utils::client_ip::{ClientIP, ClientIPConfig, ClientIPLayer}, }, utils::test_helpers::simple_req, }; diff --git a/volo-http/src/server/utils/mod.rs b/volo-http/src/server/utils/mod.rs index 38f75ff8..c9160cf5 100644 --- a/volo-http/src/server/utils/mod.rs +++ b/volo-http/src/server/utils/mod.rs @@ -5,6 +5,7 @@ mod serve_dir; pub use file_response::FileResponse; pub use serve_dir::ServeDir; +pub mod client_ip; #[cfg(feature = "multipart")] pub mod multipart; #[cfg(feature = "ws")]