How mluna030/turinganomalydetection works
The repository describes an IoT gateway whose principal workflow is packet inspection and filtering, with flow and statistics reporting over MQTT; a separate anomaly-detection branch prepares and trains modality-specific autoencoders for deployment. Firewall rule management and packet processing are visible in sampled Rust source. The README also documents anomaly alerts and a live dashboard, but no dashboard implementation appears in the supplied tree. Anomaly-runtime and daemon connections are therefore shown only where documented, or omitted where source evidence is unavailable.
Main entry points: rule.rs Rule Model · engine.rs Packet Processor · mqtt.rs MQTT Publisher · modular_dae.py Modular Autoencoder
Components 29
Firewall
- Firewall Daemon
src/router/firewall/firewall-daemon/src/main.rs - Packet Processor
src/router/firewall/firewall-core/src/application/engine.rs - Packet Model
src/router/firewall/firewall-core/src/domain/packet.rs - Firewall Backend
src/router/firewall/firewall-core/src/infrastructure/backends/backends.rs
Filtering Rules
- Rule Manager
src/router/firewall/firewall-core/src/application/rule_manager.rs - Rule Model
src/router/firewall/firewall-core/src/domain/rule.rs - Port Rules
src/router/firewall/firewall-core/src/rules/port_rules.rs - Time Rules
src/router/firewall/firewall-core/src/rules/time_rules.rs - IP and Geo Rules
src/router/firewall/firewall-core/src/rules/ip_rules.rs - Rate Limit Rules
src/router/firewall/firewall-core/src/rules/rate_limit_rules/rate_limit_rules.rs - Timed Rate Rules
src/router/firewall/firewall-core/src/rules/rate_limit_rules/time_based_limit_rule.rs - Per-Key Limiter
src/router/firewall/firewall-core/src/domain/rate_limiter/rate_limiter.rs - Token Bucket
src/router/firewall/firewall-core/src/domain/rate_limiter/token_bucket.rs - Rate Limit Config
src/router/firewall/firewall-core/src/domain/rate_limiter/rate_limit_config.rs
Telemetry
- Flow Tracker
src/router/firewall/firewall-core/src/domain/flow.rs - Firewall Statistics
src/router/firewall/firewall-core/src/domain/stats.rs - MQTT Publisher
src/router/firewall/firewall-core/src/infrastructure/mqtt/mqtt.rs
Anomaly Detection
- Modality Preprocessing
src/anomaly-detection/dae/preprocessing - Modular Autoencoder
src/anomaly-detection/dae/modular_dae.py - DAE Training
src/anomaly-detection/dae/train_dae.py - Anomaly Detection
src/anomaly-detection/detection/detect_anomalies.py - Inference Integration
src/anomaly-detection/integration/pipeline.py - Model Inference
src/anomaly-detection/inference/inference.py - TFLite Export
src/anomaly-detection/dae/export_dae_tflite.py - Sparse Autoencoder
src/anomaly-detection/sparse-autoencoder/train_sparse_ae.py - Sparse TFLite Export
src/anomaly-detection/sparse-autoencoder/export_sparse_tflite.py
Other components
- Network Traffic
- MQTT Broker
- Monitoring Dashboard
Connections 25
- Packet Processor → Packet Model: reads
src/router/firewall/firewall-core/src/application/engine.rs - Packet Processor → Flow Tracker: records flows
src/router/firewall/firewall-core/src/application/engine.rs - Packet Processor → Firewall Statistics: records packets
src/router/firewall/firewall-core/src/application/engine.rs - Packet Processor → Rule Model: evaluates filters
src/router/firewall/firewall-core/src/application/engine.rs - Rule Manager → Rule Model: creates entries
src/router/firewall/firewall-core/src/application/rule_manager.rs - Port Rules → Rule Model: implements filter
src/router/firewall/firewall-core/src/rules/port_rules.rs - Time Rules → Rule Model: implements filter
src/router/firewall/firewall-core/src/rules/time_rules.rs - IP and Geo Rules → Rule Model: implements filter
src/router/firewall/firewall-core/src/rules/ip_rules.rs - Rate Limit Rules → Rule Model: implements filter
src/router/firewall/firewall-core/src/rules/rate_limit_rules/rate_limit_rules.rs - Timed Rate Rules → Rule Model: implements filter
src/router/firewall/firewall-core/src/rules/rate_limit_rules/time_based_limit_rule.rs - Per-Key Limiter → Token Bucket: uses buckets
src/router/firewall/firewall-core/src/domain/rate_limiter/rate_limiter.rs - MQTT Publisher → Flow Tracker: reads snapshots
src/router/firewall/firewall-core/src/infrastructure/mqtt/mqtt.rs - MQTT Publisher → Firewall Statistics: reads statistics
src/router/firewall/firewall-core/src/infrastructure/mqtt/mqtt.rs - MQTT Publisher → MQTT Broker: publishes reports
src/router/firewall/firewall-core/src/infrastructure/mqtt/mqtt.rs - MQTT Broker → Monitoring Dashboard: feeds monitoring
- Network Traffic → Firewall Daemon: enters gateway
- Firewall Daemon → Packet Processor: dispatches packets
- Modality Preprocessing → Modular Autoencoder: prepares inputs
- DAE Training → Modular Autoencoder: uses model
src/anomaly-detection/dae/train_dae.py - Modular Autoencoder → TFLite Export: exports model
- Inference Integration → Model Inference: runs inference
- Model Inference → Anomaly Detection: supports detection
- Sparse Autoencoder → Sparse TFLite Export: exports model
- MQTT Publisher → Inference Integration: shares telemetry
- Anomaly Detection → Monitoring Dashboard: alerts dashboard