Module traffic_analyzer

Module traffic_analyzer 

Source
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§

PeerProfile
Peer behavior profile
TrafficAnalysis
Traffic analysis results
TrafficAnalyzer
Traffic analyzer
TrafficAnalyzerConfig
Configuration for traffic analyzer
TrafficAnalyzerStats
Traffic analyzer statistics
TrafficAnomaly
Detected anomaly
TrafficPattern
Traffic pattern detected

Enums§

AnomalyType
Type of anomaly
PatternType
Type of traffic pattern
TrafficAnalyzerError
Error types for traffic analyzer
TrafficEvent
Type of traffic event
TrendDirection
Trend direction