Expand description
Network Traffic Analysis and Pattern Detection
This module provides tools for analyzing network traffic patterns, detecting anomalies, and gaining insights into network behavior.
§Features
- Traffic Pattern Analysis: Identify patterns in connection and query behavior
- Anomaly Detection: Detect unusual network activity
- Bandwidth Analysis: Analyze bandwidth usage patterns over time
- Peer Behavior Profiling: Profile peer connection and query patterns
- Protocol Distribution: Analyze protocol usage distribution
- Time-Series Analysis: Track metrics over time windows
- Statistical Analysis: Compute statistics and trends
§Example
use ipfrs_network::traffic_analyzer::{TrafficAnalyzer, TrafficAnalyzerConfig, TrafficEvent};
use std::time::Duration;
let config = TrafficAnalyzerConfig::default();
let mut analyzer = TrafficAnalyzer::new(config);
// Record traffic events
analyzer.record_connection("peer1".to_string(), 1024);
analyzer.record_query("peer1".to_string(), Duration::from_millis(50), true);
// Analyze patterns
let analysis = analyzer.analyze()?;
println!("Total bandwidth: {} bytes", analysis.total_bandwidth);
println!("Anomalies detected: {}", analysis.anomalies.len());Structs§
- Peer
Profile - Peer behavior profile
- Traffic
Analysis - Traffic analysis results
- Traffic
Analyzer - Traffic analyzer
- Traffic
Analyzer Config - Configuration for traffic analyzer
- Traffic
Analyzer Stats - Traffic analyzer statistics
- Traffic
Anomaly - Detected anomaly
- Traffic
Pattern - Traffic pattern detected
Enums§
- Anomaly
Type - Type of anomaly
- Pattern
Type - Type of traffic pattern
- Traffic
Analyzer Error - Error types for traffic analyzer
- Traffic
Event - Type of traffic event
- Trend
Direction - Trend direction