Struct GetForwardedHeadersLayer
pub struct GetForwardedHeadersLayer<T = Forwarded> { /* private fields */ }
Expand description
Layer to extract Forwarded
information from the specified T
headers.
Use GetForwardedHeaderLayer
if you only need a single a header.
This layer can be used to extract the Forwarded
information from any specified header T
,
as long as the header implements the ForwardHeader
trait. Multiple headers can be specified
as a tuple, and the layer will extract information from them all, and combine the information.
Please take into consideration the following when combining headers:
- The last header in the tuple will take precedence over the previous headers, if the same information is present in multiple headers.
- Headers that can contain multiple elements, (e.g. X-Forwarded-For, Via) will combine their elements in the order as specified. That does however mean that in case one header has less elements then the other, that the combination down the line will not be accurate.
Rama also has the following headers already implemented for you to use:
X-Real-Ip
,X-Client-Ip
,Client-Ip
,Cf-Connecting-Ip
andTrue-Client-Ip
.
There are no GetForwardedHeadersLayer
constructors for these headers,
but you can use the GetForwardedHeadersLayer::new
constructor and pass the header type as a type parameter in a tuple with other headers.
Implementations§
§impl<T> GetForwardedHeadersLayer<T>
impl<T> GetForwardedHeadersLayer<T>
pub const fn new() -> GetForwardedHeadersLayer<T>
pub const fn new() -> GetForwardedHeadersLayer<T>
Create a new GetForwardedHeadersLayer
for the specified headers T
.
Trait Implementations§
§impl<T> Clone for GetForwardedHeadersLayer<T>where
T: Clone,
impl<T> Clone for GetForwardedHeadersLayer<T>where
T: Clone,
§fn clone(&self) -> GetForwardedHeadersLayer<T>
fn clone(&self) -> GetForwardedHeadersLayer<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<T> Debug for GetForwardedHeadersLayer<T>where
T: Debug,
impl<T> Debug for GetForwardedHeadersLayer<T>where
T: Debug,
§impl<T> Default for GetForwardedHeadersLayer<T>
impl<T> Default for GetForwardedHeadersLayer<T>
§fn default() -> GetForwardedHeadersLayer<T>
fn default() -> GetForwardedHeadersLayer<T>
§impl<H, S> Layer<S> for GetForwardedHeadersLayer<H>
impl<H, S> Layer<S> for GetForwardedHeadersLayer<H>
§type Service = GetForwardedHeadersService<S, H>
type Service = GetForwardedHeadersService<S, H>
§fn layer(&self, inner: S) -> <GetForwardedHeadersLayer<H> as Layer<S>>::Service
fn layer(&self, inner: S) -> <GetForwardedHeadersLayer<H> as Layer<S>>::Service
§fn into_layer(self, inner: S) -> Self::Service
fn into_layer(self, inner: S) -> Self::Service
layer
but consuming self after the service was created. Read moreAuto Trait Implementations§
impl<T> Freeze for GetForwardedHeadersLayer<T>
impl<T> RefUnwindSafe for GetForwardedHeadersLayer<T>
impl<T> Send for GetForwardedHeadersLayer<T>
impl<T> Sync for GetForwardedHeadersLayer<T>
impl<T> Unpin for GetForwardedHeadersLayer<T>
impl<T> UnwindSafe for GetForwardedHeadersLayer<T>
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