pub struct ClientIp {
pub ip: IpAddr,
pub forwarded: bool,
}Expand description
Best-effort client IP for the current request. Always present (see the module doc for the resolution order and the security caveat).
Fields§
§ip: IpAddrThe resolved address. 0.0.0.0 only when nothing in the chain matched.
forwarded: booltrue when the address came from X-Forwarded-For or X-Real-IP,
false when it came from the transport peer or the default.
Implementations§
Trait Implementations§
impl Copy for ClientIp
impl Eq for ClientIp
Source§impl<'a> FromRequest<'a> for ClientIp
impl<'a> FromRequest<'a> for ClientIp
Source§async fn from_request(req: &'a Request, _body: &mut RequestBody) -> Result<Self>
async fn from_request(req: &'a Request, _body: &mut RequestBody) -> Result<Self>
Extract from request head and body.
impl StructuralPartialEq for ClientIp
Auto Trait Implementations§
impl Freeze for ClientIp
impl RefUnwindSafe for ClientIp
impl Send for ClientIp
impl Sync for ClientIp
impl Unpin for ClientIp
impl UnsafeUnpin for ClientIp
impl UnwindSafe for ClientIp
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> TowerCompatExt for T
impl<T> TowerCompatExt for T
Source§fn compat<ResBody, Err, Fut>(self) -> TowerCompatEndpoint<Self>where
ResBody: Body + Send + Sync + 'static,
<ResBody as Body>::Data: Into<Bytes> + Send + 'static,
<ResBody as Body>::Error: Error + Send + Sync + 'static,
Err: Into<Error>,
Self: Sized + Service<Request<BoxBody<Bytes, Error>>, Response = Response<ResBody>, Error = Err, Future = Fut> + Clone + Send + Sync + 'static,
Fut: Future<Output = Result<Response<ResBody>, Err>> + Send + 'static,
fn compat<ResBody, Err, Fut>(self) -> TowerCompatEndpoint<Self>where
ResBody: Body + Send + Sync + 'static,
<ResBody as Body>::Data: Into<Bytes> + Send + 'static,
<ResBody as Body>::Error: Error + Send + Sync + 'static,
Err: Into<Error>,
Self: Sized + Service<Request<BoxBody<Bytes, Error>>, Response = Response<ResBody>, Error = Err, Future = Fut> + Clone + Send + Sync + 'static,
Fut: Future<Output = Result<Response<ResBody>, Err>> + Send + 'static,
Converts a tower service to a poem endpoint.