Expand description
Shared utilities for the netray.info service ecosystem.
This crate provides cross-cutting concerns used by multiple backend services:
ip_extract– Extract real client IP from proxy headers with trusted-proxy CIDR matching.error– Structured JSON error responses via theerror::ApiErrortrait.rate_limit– Keyed and global rate limiting wrappers aroundgovernor.security_headers– Axum middleware for CSP, HSTS, and other security headers.
§Example
use netray_common::ip_extract::IpExtractor;
let extractor = IpExtractor::new(&["10.0.0.0/8".to_string()]).unwrap();
// extractor.extract(&headers, peer_addr) returns the real client IP