aboutsummaryrefslogtreecommitdiffhomepage
path: root/pingora-proxy/src
diff options
context:
space:
mode:
authorJames Munns <[email protected]>2024-04-22 15:01:37 +0000
committerYuchen Wu <[email protected]>2024-05-10 15:22:37 -0700
commit880488987c610317993ca76bd4b4b97991c3848e (patch)
tree11cba35ba88164ab7bf8219562b0fbad74103d1c /pingora-proxy/src
parent2625a1b42ef4175b61591ce9a0ab31c9cc5a8146 (diff)
downloadpingora-880488987c610317993ca76bd4b4b97991c3848e.tar.gz
pingora-880488987c610317993ca76bd4b4b97991c3848e.zip
Add `Service<HttpProxy<T>>` constructor for providing name
Includes-commit: 8727b2466f9a11aec6c5386c61c51ce54946b962 Replicated-from: https://github.com/cloudflare/pingora/pull/218
Diffstat (limited to 'pingora-proxy/src')
-rw-r--r--pingora-proxy/src/lib.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/pingora-proxy/src/lib.rs b/pingora-proxy/src/lib.rs
index 7880476..da21ed3 100644
--- a/pingora-proxy/src/lib.rs
+++ b/pingora-proxy/src/lib.rs
@@ -636,3 +636,17 @@ pub fn http_proxy_service<SV>(conf: &Arc<ServerConf>, inner: SV) -> Service<Http
HttpProxy::new(inner, conf.clone()),
)
}
+
+/// Create a [Service] from the user implemented [ProxyHttp].
+///
+/// The returned [Service] can be hosted by a [pingora_core::server::Server] directly.
+pub fn http_proxy_service_with_name<SV>(
+ conf: &Arc<ServerConf>,
+ inner: SV,
+ name: &str,
+) -> Service<HttpProxy<SV>> {
+ Service::new(
+ name.to_string(),
+ HttpProxy::new(inner, conf.clone()),
+ )
+}