pub struct CompiledIpFilter { /* private fields */ }Expand description
Precompiled zero-allocation IP filter engine backing IpFilterPlugin.
Implementations§
Source§impl CompiledIpFilter
Inherent compilation, IP resolution, and filtering engine for CompiledIpFilter.
impl CompiledIpFilter
Inherent compilation, IP resolution, and filtering engine for CompiledIpFilter.
Sourcepub fn compile(config: IpFilterConfig) -> Self
pub fn compile(config: IpFilterConfig) -> Self
Sourcepub fn get_config(&self) -> &IpFilterConfig
pub fn get_config(&self) -> &IpFilterConfig
Sourcepub fn get_prebuilt_reject_wire(&self) -> &Vec<u8> ⓘ
pub fn get_prebuilt_reject_wire(&self) -> &Vec<u8> ⓘ
Returns the pre-serialized HTTP rejection response wire bytes.
§Returns
&Vec<u8>- Prebuilt wire response buffer.
Sourcepub fn is_path_exempt(&self, path: &str) -> bool
pub fn is_path_exempt(&self, path: &str) -> bool
Sourcepub fn resolve_client_ip(
&self,
peer_ip: Option<IpAddr>,
headers: &RequestHeaders,
) -> Option<ClientIp>
pub fn resolve_client_ip( &self, peer_ip: Option<IpAddr>, headers: &RequestHeaders, ) -> Option<ClientIp>
Resolves the real client IP from peer_ip and trusted forwarding headers with zero heap allocations.
Forwarding headers are strictly ignored unless peer_ip matches trusted_proxies.
§Arguments
Option<IpAddr>- Direct transport peer IP address.&RequestHeaders- Incoming request headers.
§Returns
Option<ClientIp>- Resolved client IP metadata.
Sourcepub fn is_ip_allowed(&self, ip: IpAddr) -> bool
pub fn is_ip_allowed(&self, ip: IpAddr) -> bool
Sourcepub fn evaluate(
&self,
peer_ip: Option<IpAddr>,
ctx: &mut Context,
) -> IpFilterDecision
pub fn evaluate( &self, peer_ip: Option<IpAddr>, ctx: &mut Context, ) -> IpFilterDecision
Resolves ClientIp, stores it in ctx under ATTR_CLIENT_IP, and enforces allow/deny rules.
§Arguments
Option<IpAddr>- Direct transport peer IP address.&mut Context- Incoming request and outgoing response context.
§Returns
IpFilterDecision- Enforcement outcome and resolved client IP metadata.
Trait Implementations§
Source§impl Clone for CompiledIpFilter
impl Clone for CompiledIpFilter
Auto Trait Implementations§
impl Forget for CompiledIpFilter
impl Freeze for CompiledIpFilterwhere
*const u8 is !null: Freeze,
PhantomData<IpNet>: Freeze,
PhantomData<String>: Freeze,
PhantomData<u8>: Freeze,
*const V4CidrCsr is !null: Freeze,
PhantomData<V4CidrCsr>: Freeze,
*const V6CidrCsr is !null: Freeze,
PhantomData<V6CidrCsr>: Freeze,
*const [String] is !null: Freeze,
PhantomData<[String]>: Freeze,
PhantomData<fn() -> XxHash3_64>: Freeze,
PhantomData<(String, ())>: Freeze,
impl Move for CompiledIpFilter
impl RefUnwindSafe for CompiledIpFilter
impl Send for CompiledIpFilter
impl Sync for CompiledIpFilter
impl Unpin for CompiledIpFilter
impl UnsafeUnpin for CompiledIpFilterwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<IpNet>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const V4CidrCsr is !null: UnsafeUnpin,
PhantomData<V4CidrCsr>: UnsafeUnpin,
*const V6CidrCsr is !null: UnsafeUnpin,
PhantomData<V6CidrCsr>: UnsafeUnpin,
*const [String] is !null: UnsafeUnpin,
PhantomData<[String]>: UnsafeUnpin,
PhantomData<fn() -> XxHash3_64>: UnsafeUnpin,
PhantomData<(String, ())>: UnsafeUnpin,
impl UnwindSafe for CompiledIpFilterwhere
RawVecInner: UnwindSafe,
BoxRaw<V4CidrCsr>: UnwindSafe,
BoxRaw<V6CidrCsr>: UnwindSafe,
BoxRaw<[String]>: UnwindSafe,
NonNull<u8>: UnwindSafe,
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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