pub enum IpSource {
XForwardedFor,
Header(HeaderName),
}Expand description
Determines how the client IP is extracted from the request.
Used with IpFilterConfig::source().
§Examples
use http::HeaderName;
use rune_axum_ipfilter::IpSource;
// Extract from the standard proxy header
let from_proxy = IpSource::XForwardedFor;
// Extract from a custom header set by your infrastructure
let from_custom = IpSource::Header(HeaderName::from_static("x-real-ip"));Variants§
XForwardedFor
Uses the first (leftmost) IP in the X-Forwarded-For header.
[!WARNING] Clients can spoof this header unless your reverse proxy strips and re-adds it.
Header(HeaderName)
Uses the full value of a named request header as the client IP string.
Useful when your proxy sets a single-value header such as X-Real-IP.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for IpSource
impl RefUnwindSafe for IpSource
impl Send for IpSource
impl Sync for IpSource
impl Unpin for IpSource
impl UnsafeUnpin for IpSource
impl UnwindSafe for IpSource
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