Skip to main content

Crate netray_common

Crate netray_common 

Source
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 the error::ApiError trait.
  • rate_limit – Keyed and global rate limiting wrappers around governor.
  • 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

Modules§

error
ip_extract
ip_filter
rate_limit
security_headers