pub struct EchoServiceBuilder<H> { /* private fields */ }cli and haproxy and http and net and std only.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<TlsServerConfig>) -> Self
Available on crate features boring or rustls only.
pub fn maybe_with_tls_server_config(self, cfg: Option<TlsServerConfig>) -> Self
boring or rustls only.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<TlsServerConfig>,
) -> &mut Self
Available on crate features boring or rustls only.
pub fn maybe_set_tls_server_config( &mut self, cfg: Option<TlsServerConfig>, ) -> &mut Self
boring or rustls only.define a tls server cert config to be used for tls terminaton by the echo service.
Sourcepub fn with_tls_server_config(self, cfg: TlsServerConfig) -> Self
Available on crate features boring or rustls only.
pub fn with_tls_server_config(self, cfg: TlsServerConfig) -> Self
boring or rustls only.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: TlsServerConfig) -> &mut Self
Available on crate features boring or rustls only.
pub fn set_tls_server_config(&mut self, cfg: TlsServerConfig) -> &mut Self
boring or rustls only.define a tls server cert config to be used for tls terminaton by the echo service.
Sourcepub fn without_tls_server_config(self) -> Self
Available on crate features boring or rustls only.
pub fn without_tls_server_config(self) -> Self
boring or rustls only.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
Available on crate features boring or rustls only.
pub fn unset_tls_server_config(&mut self) -> &mut Self
boring or rustls only.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 maybe_with_geo_db(self, db: Option<Arc<IpGeoDb>>) -> Self
pub fn maybe_with_geo_db(self, db: Option<Arc<IpGeoDb>>) -> Self
attach an IP geolocation database, enabling geo enrichment of the
echoed JSON. Typically built from RAMA_IP_GEO_DB.
Sourcepub fn maybe_set_geo_db(&mut self, db: Option<Arc<IpGeoDb>>) -> &mut Self
pub fn maybe_set_geo_db(&mut self, db: Option<Arc<IpGeoDb>>) -> &mut Self
attach an IP geolocation database, enabling geo enrichment of the
echoed JSON. Typically built from RAMA_IP_GEO_DB.
Sourcepub fn with_geo_db(self, db: Arc<IpGeoDb>) -> Self
pub fn with_geo_db(self, db: Arc<IpGeoDb>) -> Self
attach an IP geolocation database, enabling geo enrichment of the
echoed JSON. Typically built from RAMA_IP_GEO_DB.
Sourcepub fn set_geo_db(&mut self, db: Arc<IpGeoDb>) -> &mut Self
pub fn set_geo_db(&mut self, db: Arc<IpGeoDb>) -> &mut Self
attach an IP geolocation database, enabling geo enrichment of the
echoed JSON. Typically built from RAMA_IP_GEO_DB.
Sourcepub fn without_geo_db(self) -> Self
pub fn without_geo_db(self) -> Self
attach an IP geolocation database, enabling geo enrichment of the
echoed JSON. Typically built from RAMA_IP_GEO_DB.
Sourcepub fn unset_geo_db(&mut self) -> &mut Self
pub fn unset_geo_db(&mut self) -> &mut Self
attach an IP geolocation database, enabling geo enrichment of the
echoed JSON. Typically built from RAMA_IP_GEO_DB.
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,
exec: Executor,
) -> Result<impl Service<TcpStream, Output = (), Error = Infallible>, BoxError>
pub fn build( self, exec: Executor, ) -> Result<impl Service<TcpStream, Output = (), Error = Infallible>, BoxError>
build a tcp service ready to echo http traffic back
Sourcepub fn build_http(
&self,
exec: Executor,
) -> impl Service<Request, Output: IntoResponse, Error = Infallible> + use<H>
pub fn build_http( &self, exec: Executor, ) -> impl Service<Request, Output: 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 (const: unstable) · 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>where
H: RefUnwindSafe,
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> UnsafeUnpin for EchoServiceBuilder<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for EchoServiceBuilder<H>where
H: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§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§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writer§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writer§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writer§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writer§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer