Conversation
Replace per-request JSON deserialization + O(n) linear scan with LazyLock<RwLock<HashMap>> + AtomicBool cache. Lookups are now O(1) HashMap gets behind a read lock, and the active check is a single atomic load.
This was
linked to
issues
Mar 8, 2026
Closed
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
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.
mini-gateway-rs — experimental/ai-security Branch Report
Branch:
experimental/ai-securityDate: 2026-03-09
Commits: 18
Scope: 123 files changed, ~8,600 insertions, ~1,500 deletions
Overview
The
experimental/ai-securitybranch introduces AI-driven security capabilities to mini-gateway-rs, along with supporting infrastructure for certificate automation, real-time statistics, and overall code quality improvements. The branch spans 18 commits covering new subsystems in both the API layer (router-api) and the core routing engine (router-core), with corresponding frontend pages in the web GUI (router-gui).AI Security Subsystem
A new AI security module has been added to
router-api, built around XGBoost-based threat inference. The system operates in a thread-isolated environment to keep model loading and prediction off the main request path. Key components include:router-apitorouter-coreevery 5 secondsHashMapcache with O(1) lookups and anAtomicBoolactive flagThe frontend includes a new
/security/aipage with model table, upload modal, edit/delete modals, and inference statistics overview.Certificate Automation
Automatic SSL certificate management via Let's Encrypt (certbot) has been fully implemented. The system supports both staging and production environments with per-domain email configuration. Notable details:
Statistics and Monitoring
The statistics system was reworked from separate log-type endpoints into a unified streaming architecture:
log_bytesio,log_default,log_status_code) with a singleunified_streamthat delivers all metrics over one connectionGateway and Proxy Enhancements
Several improvements were made to the core routing infrastructure:
ContextGwin the gateway was extended with TCP metrics (RTT, retransmissions, window sizes), HTTP method/status, TLS version, and client/server IP trackingrouter-apifor inter-component communicationrouter-corefor shipping metrics externally