pub struct ClientIpConfig {
pub trusted_proxies: Vec<IpNet>,
pub num_trusted_hops: usize,
pub trusted_header: Option<HeaderName>,
}Available on crate feature
tower only.Expand description
Configuration for deriving the rate-limit key from the client IP.
See the module docs for the resolution algorithm.
The default is secure by default: no trusted proxies means the forwarded header is ignored and every client is keyed by its socket address.
Fields§
§trusted_proxies: Vec<IpNet>Peers whose forwarded header we may believe. EMPTY DEFAULT = forwarded header ignored entirely (secure by default).
num_trusted_hops: usizeRight-to-left walk: skip this many entries (our proxy chain), the next entry leftward is the client. NEVER trust left-to-right. Default 1.
trusted_header: Option<HeaderName>Header override for platforms with dedicated headers
(CF-Connecting-IP, True-Client-IP). Same trust rules apply.
Default None = X-Forwarded-For.
Trait Implementations§
Source§impl Clone for ClientIpConfig
impl Clone for ClientIpConfig
Source§impl Debug for ClientIpConfig
impl Debug for ClientIpConfig
Auto Trait Implementations§
impl !Freeze for ClientIpConfig
impl RefUnwindSafe for ClientIpConfig
impl Send for ClientIpConfig
impl Sync for ClientIpConfig
impl Unpin for ClientIpConfig
impl UnsafeUnpin for ClientIpConfig
impl UnwindSafe for ClientIpConfig
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