-
Notifications
You must be signed in to change notification settings - Fork 0
Enhance mesh v2 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, request_timeout was configured but never enforced, allowing requests to hang indefinitely if upstream servers were slow or unresponsive. Changes: - Add timeout parameter to ProxyService::new() and Listener::bind() - Wrap client.request() with tokio::time::timeout() - Return 504 Gateway Timeout when requests exceed configured duration - Update all tests and doc examples with timeout parameter - Add integration test validating timeout behavior Breaking Change: API now requires Duration parameter Fixes potential DoS via slow upstreams
Implement Hystrix-style circuit breaker for preventing cascading failures. Features: - Three states: Closed, Open, HalfOpen - Configurable failure/success thresholds - Automatic timeout-based recovery - Lock-free atomic operations for performance - Full async/await support - Statistics tracking Implementation: - State transitions based on failure patterns - Closed -> Open after failure_threshold failures - Open -> HalfOpen after timeout duration - HalfOpen -> Closed after success_threshold successes - HalfOpen -> Open immediately on failure Testing: - 5 comprehensive unit tests covering all state transitions - 100% test coverage of state machine logic Note: Module is ready for integration but not yet wired into ProxyService. This allows gradual adoption and keeps this change focused.
Add two runnable examples demonstrating core functionality: basic_proxy.rs: - Minimal proxy setup with httpbin.org upstream - Shows listener creation and graceful shutdown - Full error handling and Ctrl+C handling - Good starting point for new users circuit_breaker_demo.rs: - Demonstrates all circuit breaker state transitions - 5 test scenarios with detailed logging - Statistics output - Educational tool for understanding circuit breaker behavior Run with: cargo run --example basic_proxy cargo run --example circuit_breaker_demo
Add MIT and Apache 2.0 licenses, allowing users to choose the license that works best for their use case. This is standard practice in the Rust ecosystem. Copyright 2024 HueCodes
Add comprehensive contributor guidelines covering: - Development workflow and setup - Code quality standards and testing requirements - Pull request process and commit message format - Architecture guidelines (async/await, error handling, dependencies) - Testing requirements (>80% coverage target) - Areas for contribution (prioritized feature list) These guidelines ensure consistent code quality and make it easier for new contributors to get started.
Add comprehensive CI/CD pipeline with 9 jobs: 1. Test Suite - Multi-platform (Ubuntu + macOS), multi-version (stable + nightly) 2. Code Formatting - Enforce rustfmt 3. Linting - Clippy with warnings as errors 4. Security Audit - cargo audit for vulnerabilities 5. Code Coverage - tarpaulin with Codecov upload 6. Build - Debug and release on multiple platforms 7. Examples Build - Ensure examples compile 8. Dependency Check - Monitor outdated deps 9. Benchmarks - Performance regression tracking (main only) Features: - Cargo caching for faster builds - Fail fast on critical issues - Coverage reporting - Multi-platform validation This ensures code quality and prevents regressions.
Implements full HTTP/2 support with ALPN-based protocol negotiation and TLS termination using Rustls. Features: - HTTP/2 and HTTP/1.1 protocol support with automatic negotiation - TLS configuration with certificate/key loading - ALPN protocol negotiation (prefers HTTP/2) - h2c (HTTP/2 cleartext) support for internal traffic - Client TLS configuration with optional mTLS - Enhanced listener with bind_with_tls() and bind_h2c() methods - Comprehensive error types for TLS and protocol errors Dependencies added: - rustls-pemfile for certificate parsing - webpki-roots for root CA certificates - Enhanced rustls and hyper features for HTTP/2
Implements comprehensive rate limiting using token bucket algorithm with support for both global and per-client limiting. Features: - Token bucket algorithm with configurable refill rate - Global rate limiting across all requests - Per-client rate limiting with IP-based tracking - Configurable burst capacity for traffic spikes - Automatic cleanup of expired client entries - RateLimitLayer for Tower middleware integration - Detailed rate limit statistics and monitoring The rate limiter provides: - requests_per_second: configurable request rate - burst_size: allows temporary spikes above the base rate - per_client: optional IP-based limiting - client_ttl: automatic cleanup of idle clients
Implements configurable retry logic with exponential backoff and jitter for handling transient failures in upstream requests. Features: - Exponential backoff with configurable multiplier - Jitter to prevent thundering herd - Configurable retry policies and max attempts - Retryable status codes (502, 503, 504 by default) - Automatic retry on connection errors and timeouts - RetryExecutor for async request execution - Comprehensive retry statistics tracking Configuration options: - max_retries: maximum number of retry attempts - base_delay: initial delay between retries - max_delay: cap on exponential backoff - backoff_multiplier: exponential growth factor - use_jitter: randomize delays to avoid synchronized retries - retryable_status_codes: HTTP status codes to retry
Implements comprehensive L7 routing with path/header/method matching and advanced load balancing with connection pooling. L7 Routing Features: - Path matching: exact, prefix, and regex patterns - Header-based routing with presence and value matching - Method-based routing (GET, POST, PUT, DELETE, etc.) - Path rewriting capabilities - Route priority and fallback handling - Cluster-based upstream selection Load Balancing Features: - Multiple strategies: round-robin, least connections, random, weighted - Connection pooling with configurable pool sizes - Health tracking with circuit breaker integration - Endpoint weight and priority support - Automatic failover to healthy endpoints - Connection reuse and efficient resource management Transport Enhancements: - Pool-based connection management - Per-endpoint health tracking - Configurable pool sizes and timeouts - Integration with circuit breaker for fault tolerance
Adds production-ready Docker configuration and comprehensive performance benchmarking suite. Docker Features: - Multi-stage build for minimal image size - Debian bookworm-slim base for compatibility - Non-root user for security - Health check endpoint integration - Optimized layer caching for faster builds - Environment variable configuration - Exposed ports for proxy (3000) and metrics (9090) Benchmark Suite: - Criterion-based performance benchmarks - Proxy throughput and latency testing - Load balancing strategy comparisons - Circuit breaker performance impact - Async Tokio runtime benchmarks - Comprehensive metrics collection Examples Updated: - Enhanced basic proxy example - Circuit breaker demo improvements - Updated for new API surface
Adds detailed project documentation, changelog, and updated tests. Documentation: - Comprehensive README with architecture diagrams - Feature overview and quick start guide - Environment variable configuration table - Usage examples for all major features - Docker deployment instructions - Module overview and descriptions - Configuration examples for HTTP/2, TLS, routing Changelog: - Detailed changelog following Keep a Changelog format - Semantic versioning compliance - All new features documented for unreleased version - Changes, fixes, and additions categorized Tests: - Updated integration tests for new features - Enhanced test coverage - Tests for HTTP/2, rate limiting, and routing
HueCodes
added a commit
that referenced
this pull request
Dec 11, 2025
Merge pull request #3 from HueCodes/enhance-mesh-v2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.