Features

Comprehensive capabilities of Sentinel reverse proxy, with direct source code references

57+
Major Features
120+
Source Files
100%
Rust Code

Core Proxy Features

HTTP Routing

routing.rs

Advanced request routing with multiple matching strategies and lock-free route caching.

  • Path prefix, exact, and regex matching
  • Host matching (exact and wildcard)
  • Header presence/value matching
  • HTTP method matching
  • Query parameter matching
  • Priority-based route evaluation
  • Lock-free route caching with DashMap
Structs:RouteMatcher, CompiledRoute, CompiledMatcher

Load Balancing

upstream/mod.rs

14 load balancing algorithms with health-aware target selection.

  • Round-robin - Equal distribution across backends
  • Weighted - Proportional distribution by weight
  • Least Connections - Fewest active connections
  • Weighted Least Conn - Connection/weight ratio (weighted_least_conn.rs)
  • Maglev - Google's consistent hashing, O(1) lookup (maglev.rs)
  • Peak EWMA - Latency-based selection (peak_ewma.rs)
  • Locality-Aware - Zone-preference routing (locality.rs)
  • Deterministic Subset - Subset per proxy for large clusters (subset.rs)
  • Power of Two Choices - Best of two random (p2c.rs)
  • Consistent Hash - Ring-based affinity (consistent_hash.rs)
  • Adaptive - Response time based (adaptive.rs)
  • Least Tokens Queued - LLM workload optimization (least_tokens.rs)

Service Discovery

discovery.rs

Dynamic backend discovery from multiple sources.

  • Static - Fixed backend list
  • DNS A/AAAA - DNS record resolution with refresh
  • DNS SRV - Service record lookup
  • Consul - Consul service catalog integration
  • Kubernetes - K8s service endpoints discovery
  • File - File-watched backend list

Scoped Routing

scoped_routing.rs

Namespace and service-aware routing with hierarchical configuration.

  • Per-scope route isolation (global → namespace → service)
  • Scope-aware visibility rules
  • Independent route matchers per scope
  • Qualified ID resolution

Security Features

TLS/SSL Termination

tls.rs

Enterprise-grade TLS with SNI routing and hot certificate reload.

  • SNI (Server Name Indication) based certificate selection
  • Wildcard certificate matching
  • mTLS client certificate verification (inbound)
  • Certificate hot-reload (SIGHUP trigger)
  • OCSP stapling support
Structs:SniResolver, HotReloadableSniResolver, OcspStapler

mTLS to Upstreams

upstream/mod.rs

Mutual TLS for secure backend connections in zero-trust architectures.

  • Client certificate authentication - Present certificates to upstreams
  • Custom CA verification - Verify upstream server certificates
  • SNI configuration - Per-upstream Server Name Indication
  • Certificate chain support - Include intermediate certificates
  • Combined PEM files - Cert and key in single file
Functions:load_client_cert_key, build_upstream_tls_config
View configuration guide →

Rate Limiting

rate_limit.rs

Flexible rate limiting with multiple keying strategies and actions.

  • Per-route and per-client rate limiting
  • Local in-memory limiting (Pingora-based)
  • Distributed limiting via Redis (distributed_rate_limit.rs)
  • Distributed limiting via Memcached (memcached_rate_limit.rs)
  • Keying strategies: ClientIP, UserID, CustomHeader
  • Actions: Reject (429), Delay, Allow
  • Burst support with configurable max delay

Web Application Firewall (WAF)

config/waf.rs

OWASP CRS-compatible WAF with anomaly scoring and rule tuning.

  • Multiple engines: ModSecurity, Coraza, Custom
  • OWASP Core Rule Set (CRS) integration
  • Paranoia levels 1-4 configuration
  • Anomaly scoring system
  • Rule exclusions and tuning
  • Body inspection with content-type allowlist
  • Audit logging with rule IDs

GeoIP Filtering

geo_filter.rs

Geographic access control with multiple database support.

  • MaxMind GeoLite2/GeoIP2 support (.mmdb)
  • IP2Location database support (.bin)
  • Country-based blocklist/allowlist
  • Log-only mode for testing
  • IP→Country caching with TTL
  • Fail-open/fail-closed policies
  • X-GeoIP-Country header injection

Request Decompression & Zip Bomb Protection

decompression.rs

Safe request body decompression with ratio limits to prevent attacks.

  • Zip bomb protection via decompression ratio limits
  • Size limits for decompressed output
  • Support for gzip, deflate, brotli
  • Incremental ratio checking
  • Statistics tracking

External Agent Processing

agents/mod.rs

Extensible agent system for authentication, authorization, and custom processing.

  • Unix Domain Socket transport
  • gRPC transport support
  • Per-agent queue isolation (semaphore-based)
  • Circuit breaker per agent
  • Timeouts with fail-open/fail-closed
  • Request/response header mutation
  • Request body streaming
  • Audit metadata collection

Observability Features

Structured Logging

logging.rs

Comprehensive logging with trace ID correlation and multiple formats.

  • Access logs - Request/response with trace_id correlation
  • Error logs - Errors with context
  • Audit logs - Security events with rule IDs
  • JSON format - Structured, queryable logs
  • Combined Log Format - Apache/nginx compatible
  • Fields: timestamp, trace_id, method, path, status, duration_ms, client_ip, route_id, upstream

Distributed Tracing (OpenTelemetry)

otel.rs

OpenTelemetry-based distributed tracing with multiple backend support.

  • W3C Trace Context header propagation
  • OTLP export to Jaeger, Tempo, or compatible backends
  • Configurable sampling rates
  • Request lifecycle spans
  • Semantic conventions compliance

Trace ID Generation

trace_id.rs

Efficient trace ID generation with multiple format support.

  • TinyFlake - 11-char Base58 ID (time-prefixed for sorting)
  • UUID - Standard 36-char UUID format
  • Header propagation (X-Trace-Id, X-Correlation-Id, X-Request-Id)

Prometheus-compatible metrics for monitoring and alerting.

  • Per-route latency histograms
  • Request counts by status code
  • Upstream health status
  • Circuit breaker state transitions
  • Agent latencies and timeouts
  • Rate limit enforcement outcomes
  • Cache hit/miss rates

Advanced Features

HTTP Response Caching

cache.rs

Pingora-based HTTP caching with stampede prevention.

  • Cache key generation
  • TTL calculation from Cache-Control
  • LRU eviction management
  • Cache lock for stampede prevention
  • Per-route cache configuration
  • In-memory and pluggable backends

In-Memory Caching (S3-FIFO + TinyLFU)

memory_cache.rs

Advanced eviction algorithms for hot-data caching.

  • S3-FIFO + TinyLFU eviction
  • Fast hot-data caching
  • Configurable TTL per item
  • Hit rate statistics
  • Thread-safe concurrent access

Static File Serving

static_files/mod.rs

High-performance static file delivery with zero-copy and compression.

  • Range request support (206 Partial Content)
  • Zero-copy serving via memory-mapped files (>10MB)
  • On-the-fly gzip/brotli compression
  • In-memory caching for small files (<1MB)
  • Directory listing (configurable)
  • SPA routing with fallback
  • ETag and last-modified headers

WebSocket Proxying

websocket/mod.rs

RFC 6455 compliant WebSocket support with frame inspection.

  • Frame-level parsing and validation
  • Masking/unmasking support
  • Per-frame agent inspection
  • Configurable max frame size
  • Bidirectional frame handling

Traffic Mirroring/Shadowing

shadow.rs

Fire-and-forget request duplication for canary testing.

  • Fire-and-forget duplication to shadow upstreams
  • Sampling-based mirroring (percentage control)
  • Header-based sampling
  • Optional request body buffering
  • Async execution (non-blocking)

LLM/Inference Token-Based Rate Limiting

inference/mod.rs

Token-aware rate limiting for LLM workloads.

  • Token-based rate limiting (tokens/minute)
  • Multi-provider support: OpenAI, Anthropic, Generic
  • Model-aware load balancing (LeastTokensQueued)
  • Request body parsing for token estimation
  • Burst token allocation

Health Checking

health.rs

Active and passive health checking with multiple protocols.

  • HTTP - GET request with expected status
  • TCP - Connection test
  • gRPC - gRPC health check protocol (grpc_health.rs)
  • Configurable intervals and thresholds
  • Response time averaging
  • Passive health inference from failures

Scope-aware circuit breakers for cascading failure prevention.

  • Per-upstream circuit breakers
  • Scope-aware configuration (global/namespace/service)
  • States: Closed, Open, Half-open
  • Configurable failure/success thresholds
  • Timeout for half-open state

Configuration Capabilities

Multiple Configuration Formats

config/lib.rs

Flexible configuration with human-friendly and machine-friendly formats.

  • KDL - Primary human-friendly format (kdl/mod.rs)
  • JSON - Programmatic/API use
  • TOML - Alternative text format
  • Extension auto-detection

Multi-File Configuration

config/multi_file/mod.rs

Directory-based configuration with automatic merging.

  • Load configs from directory with pattern matching
  • Merge multiple config files
  • Load order control
  • Validate merged configuration

Configuration Validation

config/validation.rs

Comprehensive validation before config application.

  • Schema compliance (JSONSchema)
  • Referential integrity (routes → upstreams/filters/agents)
  • Required fields presence
  • Value ranges and format
  • Network address validity
  • Certificate/key accessibility

Hot Reload (Zero-Downtime)

reload/mod.rs

Atomic configuration updates without dropping connections.

  • Zero-downtime config reloading
  • SIGHUP signal trigger
  • File change detection
  • Validation before apply
  • Atomic config swaps (ArcSwap)
  • Graceful request draining
  • Rollback on error

Schema Versioning

config/lib.rs

Version-aware configuration with compatibility checking.

  • Current schema version: 1.0
  • Compatibility checking on load
  • Forward/backward compatibility warnings
  • Minimum version enforcement

Namespaces & Service Scoping

config/namespace.rs

Hierarchical multi-tenancy with resource isolation.

  • Hierarchical organization: Global → Namespace → Service
  • Per-scope routes, upstreams, agents, filters
  • Resource visibility rules
  • Cross-scope resource export
  • Scope-aware request routing

Filter Chain Configuration

config/filters.rs

Composable filter pipeline with named instances.

  • Filter types: Agent, RateLimit, Headers, Compress, Custom
  • Named filter instances (reusable)
  • Ordered filter pipeline
  • Per-filter timeout and failure mode
  • Phase-based execution (request/response)

Performance Features

Connection Pooling

upstream/mod.rs

Efficient connection reuse with configurable pool sizes.

  • Configurable pool sizes per upstream
  • Keep-alive timeout
  • Max requests per connection
  • Idle connection reuse

HTTP/2 Support

upstream/mod.rs

Full HTTP/2 support with request pipelining.

  • HTTP/2 upstream connections
  • HTTP/1.1 keepalive with automatic reuse
  • Configurable per upstream

Lock-Free Data Structures

routing.rs

Minimal lock contention for high throughput.

  • DashMap-based route cache
  • Lock-free rate limiter pools
  • Concurrent upstream pools
  • Circuit breaker registry

Memory Efficiency

static_files/mod.rs

Optimized memory usage with bounded resources.

  • Bounded queues (all queues have max size)
  • Memory-mapped file serving (zero-copy)
  • Pre-computed compression for static files
  • S3-FIFO + TinyLFU eviction

Memory Safety & Performance

GitHub

Sentinel is built entirely in Rust for guaranteed memory safety without garbage collection.

  • Zero buffer overflows - Compile-time memory safety
  • No null pointer exceptions - Option types enforce checks
  • No data races - Fearless concurrency with ownership
  • Predictable performance - No GC pauses
  • Low memory footprint - Efficient memory usage
  • Native performance - Compiled to machine code

Cloudflare's Battle-Tested Framework

Pingora on GitHub

Sentinel is built on Pingora, Cloudflare's open-source Rust framework that handles over a trillion requests per day in production.

  • Production proven - Powers Cloudflare's global edge network
  • Async-first architecture - Built on Tokio for maximum concurrency
  • HTTP/1.1 & HTTP/2 - Full protocol support with connection reuse
  • Connection pooling - Efficient upstream connection management
  • TLS termination - Native rustls integration with modern cipher suites
  • Zero-downtime upgrades - Graceful restarts without dropping connections
  • Extensible architecture - Filter and callback system for custom logic

Pingora provides the high-performance networking foundation, while Sentinel adds security-first configuration, the external agent system, and production-ready defaults.