pub struct EchoServiceBuilder<H> { /* private fields */ }
Expand description
Builder that can be used to run your own echo Service
,
echo’ing back information about that request and its underlying transport / presentation layers.
Implementations§
Source§impl EchoServiceBuilder<()>
impl EchoServiceBuilder<()>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new EchoServiceBuilder
.
Source§impl<H> EchoServiceBuilder<H>
impl<H> EchoServiceBuilder<H>
Sourcepub fn with_concurrent(self, limit: usize) -> Self
pub fn with_concurrent(self, limit: usize) -> Self
set the number of concurrent connections to allow
(0 = no limit)
Sourcepub fn set_concurrent(&mut self, limit: usize) -> &mut Self
pub fn set_concurrent(&mut self, limit: usize) -> &mut Self
set the number of concurrent connections to allow
(0 = no limit)
Sourcepub fn with_body_limit(self, limit: usize) -> Self
pub fn with_body_limit(self, limit: usize) -> Self
set the body limit in bytes for each request
Sourcepub fn set_body_limit(&mut self, limit: usize) -> &mut Self
pub fn set_body_limit(&mut self, limit: usize) -> &mut Self
set the body limit in bytes for each request
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
set the timeout in seconds for each connection
(0 = no timeout)
Sourcepub fn set_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn set_timeout(&mut self, timeout: Duration) -> &mut Self
set the timeout in seconds for each connection
(0 = no timeout)
Sourcepub fn maybe_with_forward(self, kind: Option<ForwardKind>) -> Self
pub fn maybe_with_forward(self, kind: Option<ForwardKind>) -> Self
enable support for one of the following “forward” headers or protocols
Supported headers:
Forwarded (“for=”), X-Forwarded-For
X-Client-IP Client-IP, X-Real-IP
CF-Connecting-IP, True-Client-IP
Or using HaProxy protocol.
Sourcepub fn maybe_set_forward(&mut self, kind: Option<ForwardKind>) -> &mut Self
pub fn maybe_set_forward(&mut self, kind: Option<ForwardKind>) -> &mut Self
enable support for one of the following “forward” headers or protocols
Supported headers:
Forwarded (“for=”), X-Forwarded-For
X-Client-IP Client-IP, X-Real-IP
CF-Connecting-IP, True-Client-IP
Or using HaProxy protocol.
Sourcepub fn with_forward(self, kind: ForwardKind) -> Self
pub fn with_forward(self, kind: ForwardKind) -> Self
enable support for one of the following “forward” headers or protocols
Supported headers:
Forwarded (“for=”), X-Forwarded-For
X-Client-IP Client-IP, X-Real-IP
CF-Connecting-IP, True-Client-IP
Or using HaProxy protocol.
Sourcepub fn set_forward(&mut self, kind: ForwardKind) -> &mut Self
pub fn set_forward(&mut self, kind: ForwardKind) -> &mut Self
enable support for one of the following “forward” headers or protocols
Supported headers:
Forwarded (“for=”), X-Forwarded-For
X-Client-IP Client-IP, X-Real-IP
CF-Connecting-IP, True-Client-IP
Or using HaProxy protocol.
Sourcepub fn without_forward(self) -> Self
pub fn without_forward(self) -> Self
enable support for one of the following “forward” headers or protocols
Supported headers:
Forwarded (“for=”), X-Forwarded-For
X-Client-IP Client-IP, X-Real-IP
CF-Connecting-IP, True-Client-IP
Or using HaProxy protocol.
Sourcepub fn unset_forward(&mut self) -> &mut Self
pub fn unset_forward(&mut self) -> &mut Self
enable support for one of the following “forward” headers or protocols
Supported headers:
Forwarded (“for=”), X-Forwarded-For
X-Client-IP Client-IP, X-Real-IP
CF-Connecting-IP, True-Client-IP
Or using HaProxy protocol.
Sourcepub fn maybe_with_tls_server_config(self, cfg: Option<ServerConfig>) -> Self
pub fn maybe_with_tls_server_config(self, cfg: Option<ServerConfig>) -> Self
define a tls server cert config to be used for tls terminaton by the echo service.
Sourcepub fn maybe_set_tls_server_config(
&mut self,
cfg: Option<ServerConfig>,
) -> &mut Self
pub fn maybe_set_tls_server_config( &mut self, cfg: Option<ServerConfig>, ) -> &mut Self
define a tls server cert config to be used for tls terminaton by the echo service.
Sourcepub fn with_tls_server_config(self, cfg: ServerConfig) -> Self
pub fn with_tls_server_config(self, cfg: ServerConfig) -> Self
define a tls server cert config to be used for tls terminaton by the echo service.
Sourcepub fn set_tls_server_config(&mut self, cfg: ServerConfig) -> &mut Self
pub fn set_tls_server_config(&mut self, cfg: ServerConfig) -> &mut Self
define a tls server cert config to be used for tls terminaton by the echo service.
Sourcepub fn without_tls_server_config(self) -> Self
pub fn without_tls_server_config(self) -> Self
define a tls server cert config to be used for tls terminaton by the echo service.
Sourcepub fn unset_tls_server_config(&mut self) -> &mut Self
pub fn unset_tls_server_config(&mut self) -> &mut Self
define a tls server cert config to be used for tls terminaton by the echo service.
Sourcepub fn maybe_with_http_version(self, version: Option<Version>) -> Self
pub fn maybe_with_http_version(self, version: Option<Version>) -> Self
set the http version to use for the http server (auto by default)
Sourcepub fn maybe_set_http_version(&mut self, version: Option<Version>) -> &mut Self
pub fn maybe_set_http_version(&mut self, version: Option<Version>) -> &mut Self
set the http version to use for the http server (auto by default)
Sourcepub fn with_http_version(self, version: Version) -> Self
pub fn with_http_version(self, version: Version) -> Self
set the http version to use for the http server (auto by default)
Sourcepub fn set_http_version(&mut self, version: Version) -> &mut Self
pub fn set_http_version(&mut self, version: Version) -> &mut Self
set the http version to use for the http server (auto by default)
Sourcepub fn without_http_version(self) -> Self
pub fn without_http_version(self) -> Self
set the http version to use for the http server (auto by default)
Sourcepub fn unset_http_version(&mut self) -> &mut Self
pub fn unset_http_version(&mut self) -> &mut Self
set the http version to use for the http server (auto by default)
Sourcepub fn with_http_layer<H2>(self, layer: H2) -> EchoServiceBuilder<(H, H2)>
pub fn with_http_layer<H2>(self, layer: H2) -> EchoServiceBuilder<(H, H2)>
add a custom http layer which will be applied to the existing http layers
Sourcepub fn maybe_with_user_agent_database(
self,
db: Option<Arc<UserAgentDatabase>>,
) -> Self
pub fn maybe_with_user_agent_database( self, db: Option<Arc<UserAgentDatabase>>, ) -> Self
maybe set the user agent datasbase that if set would be used to look up a user agent (by ua header string) to see if we have a ja3/ja4 hash.
Sourcepub fn maybe_set_user_agent_database(
&mut self,
db: Option<Arc<UserAgentDatabase>>,
) -> &mut Self
pub fn maybe_set_user_agent_database( &mut self, db: Option<Arc<UserAgentDatabase>>, ) -> &mut Self
maybe set the user agent datasbase that if set would be used to look up a user agent (by ua header string) to see if we have a ja3/ja4 hash.
Sourcepub fn with_user_agent_database(self, db: Arc<UserAgentDatabase>) -> Self
pub fn with_user_agent_database(self, db: Arc<UserAgentDatabase>) -> Self
maybe set the user agent datasbase that if set would be used to look up a user agent (by ua header string) to see if we have a ja3/ja4 hash.
Sourcepub fn set_user_agent_database(
&mut self,
db: Arc<UserAgentDatabase>,
) -> &mut Self
pub fn set_user_agent_database( &mut self, db: Arc<UserAgentDatabase>, ) -> &mut Self
maybe set the user agent datasbase that if set would be used to look up a user agent (by ua header string) to see if we have a ja3/ja4 hash.
Sourcepub fn without_user_agent_database(self) -> Self
pub fn without_user_agent_database(self) -> Self
maybe set the user agent datasbase that if set would be used to look up a user agent (by ua header string) to see if we have a ja3/ja4 hash.
Sourcepub fn unset_user_agent_database(&mut self) -> &mut Self
pub fn unset_user_agent_database(&mut self) -> &mut Self
maybe set the user agent datasbase that if set would be used to look up a user agent (by ua header string) to see if we have a ja3/ja4 hash.
Sourcepub fn with_ws_support(self, support: bool) -> Self
pub fn with_ws_support(self, support: bool) -> Self
define whether or not WS support is enabled
Sourcepub fn set_ws_support(&mut self, support: bool) -> &mut Self
pub fn set_ws_support(&mut self, support: bool) -> &mut Self
define whether or not WS support is enabled
Source§impl<H> EchoServiceBuilder<H>
impl<H> EchoServiceBuilder<H>
Sourcepub fn build(
self,
executor: Executor,
) -> Result<impl Service<TcpStream, Response = (), Error = Infallible>, BoxError>
pub fn build( self, executor: Executor, ) -> Result<impl Service<TcpStream, Response = (), Error = Infallible>, BoxError>
build a tcp service ready to echo http traffic back
Sourcepub fn build_http(
&self,
) -> impl Service<Request, Response: IntoResponse, Error = Infallible> + use<H>
pub fn build_http( &self, ) -> impl Service<Request, Response: IntoResponse, Error = Infallible> + use<H>
build an http service ready to echo http traffic back
Trait Implementations§
Source§impl<H: Clone> Clone for EchoServiceBuilder<H>
impl<H: Clone> Clone for EchoServiceBuilder<H>
Source§fn clone(&self) -> EchoServiceBuilder<H>
fn clone(&self) -> EchoServiceBuilder<H>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<H: Debug> Debug for EchoServiceBuilder<H>
impl<H: Debug> Debug for EchoServiceBuilder<H>
Auto Trait Implementations§
impl<H> Freeze for EchoServiceBuilder<H>where
H: Freeze,
impl<H> !RefUnwindSafe for EchoServiceBuilder<H>
impl<H> Send for EchoServiceBuilder<H>where
H: Send,
impl<H> Sync for EchoServiceBuilder<H>where
H: Sync,
impl<H> Unpin for EchoServiceBuilder<H>where
H: Unpin,
impl<H> !UnwindSafe for EchoServiceBuilder<H>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more