Skip to main content

hyperlane_plugin_ip_filter/
lib.rs

1//! hyperlane-plugin-ip-filter
2//!
3//! Zero-allocation IP allowlist/denylist and anti-spoofing client IP extraction
4//! plugin for Hyperlane with `/8` radix-indexed IPv4/IPv6 CIDR lookup,
5//! IPv4-mapped IPv6 canonicalization, right-to-left trusted proxy peeling, and
6//! prebuilt `403 Forbidden` wire responses.
7
8mod r#const;
9mod r#enum;
10mod r#fn;
11mod r#impl;
12mod r#static;
13mod r#struct;
14
15#[cfg(test)]
16#[path = "../tests/mod.rs"]
17mod tests;
18
19pub use {r#const::*, r#enum::*, r#fn::*, r#struct::*};
20
21pub(crate) use r#static::*;
22
23use std::{
24    collections::VecDeque,
25    error::Error,
26    fmt::{self, Display, Formatter},
27    net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
28    str::{FromStr, from_utf8},
29    sync::OnceLock,
30};
31
32use {
33    hyperlane::{
34        CONTENT_TYPE, Context, FORWARDED, HashSetXxHash3_64, HttpStatus, RequestHeaders, Response,
35        ResponseError, ServerHook, Status, Stream, X_FORWARDED_FOR, X_REAL_IP,
36        hash_set_xx_hash3_64,
37    },
38    lombok_macros::*,
39};