diff options
author | James Munns <[email protected]> | 2024-04-22 15:01:37 +0000 |
---|---|---|
committer | Yuchen Wu <[email protected]> | 2024-05-10 15:22:37 -0700 |
commit | 880488987c610317993ca76bd4b4b97991c3848e (patch) | |
tree | 11cba35ba88164ab7bf8219562b0fbad74103d1c /pingora-proxy/src | |
parent | 2625a1b42ef4175b61591ce9a0ab31c9cc5a8146 (diff) | |
download | pingora-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.rs | 14 |
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()), + ) +} |