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()]);
// extractor.extract(&headers, peer_addr) returns the real client IPModules§
- ecosystem
- Ecosystem service URL configuration shared across netray.info services.
- error
- ip_
extract - ip_
filter - metrics
- Metrics namespace marker trait for service-specific metric prefixes.
- rate_
limit - security_
headers - target_
policy - Unified target IP validation — SSRF blocklist covering all special ranges.