hyperlane-plugin-ip-filter 23.3.0

A zero-allocation IP allowlist/denylist and anti-spoofing client IP extraction plugin for the Hyperlane framework with /8 radix-indexed CIDR lookup, IPv4-mapped IPv6 canonicalization, RFC 7239 Forwarded/X-Forwarded-For right-to-left proxy peeling, and prebuilt 403 wire responses.
Documentation

hyperlane-plugin-ip-filter

Zero-Allocation Client IP Extraction & Radix CIDR Allowlist/Denylist Plugin

crates.io docs.rs Rust 2024 License: MIT

Workspace Overview · Plugin Catalog · API Docs


Overview

Opt-in request middleware (order -125) resolving the true client IP from Stream::get_peer_addr with anti-spoofing right-to-left hop peeling across trusted proxies (X-Forwarded-For, RFC 7239 Forwarded, and X-Real-IP), injecting ClientIp into Hyperlane Context (ATTR_CLIENT_IP), and enforcing zero-allocation /8 radix-indexed IPv4/IPv6 CIDR allowlists and denylists with IPv4-mapped IPv6 canonicalization (::ffff:a.b.c.d) and prebuilt rejection wire responses.

This crate is a member of the hyperlane unified Rust 2024 workspace. All plugin crates are opt-in and transparent (Status::Continue) when unconfigured.

Responsibilities & Module Layout

  • struct / enum / impl — IpNet, CidrTable, ClientIp, IpFilterConfig, CompiledIpFilter, IpFilterPlugin, and IpFilterHook (-125)
  • fn — Zero-allocation right-to-left proxy peeling, IPv4-mapped IPv6 canonicalization, and RFC 7239 Forwarded parsing

Installation

cargo add hyperlane-plugin-ip-filter

Verification

Run crate-scoped formatting, lint, and test gates from the workspace root:

cargo run -p hyperlane-cli -- fmt --check
cargo clippy -p hyperlane-plugin-ip-filter --all-features --all-targets -- -D warnings
cargo test -p hyperlane-plugin-ip-filter --all-features

Documentation & Governance

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For inquiries, please contact the author at root@devhub.vip.